INTSAMPLES-89 - Upgrade to Spring Integration 2.2 RC3
* Test samples * Polish documentation * Polish code For reference see: https://jira.springsource.org/browse/INTSAMPLES-89
This commit is contained in:
@@ -4,16 +4,20 @@
|
||||
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>amqp</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Samples (Basic) - AMQP</name>
|
||||
<url>http://www.springsource.org/spring-integration</url>
|
||||
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
|
||||
@@ -29,7 +33,7 @@
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-eclipse-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<version>2.9</version>
|
||||
<configuration>
|
||||
<additionalProjectnatures>
|
||||
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
|
||||
@@ -44,7 +48,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
@@ -56,7 +60,7 @@
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2</version>
|
||||
<version>1.2.1</version>
|
||||
<configuration>
|
||||
<mainClass>org.springframework.integration.samples.amqp.Main</mainClass>
|
||||
</configuration>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-amqp="http://www.springframework.org/schema/integration/amqp"
|
||||
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
|
||||
xmlns:int-stream="http://www.springframework.org/schema/integration/stream"
|
||||
@@ -10,49 +9,51 @@
|
||||
http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd
|
||||
http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<!-- From STDIN To RabbitMQ -->
|
||||
|
||||
<int-stream:stdin-channel-adapter id="consoleIn" channel="toRabbit" >
|
||||
<int:poller fixed-delay="1000" max-messages-per-poll="1" />
|
||||
</int-stream:stdin-channel-adapter>
|
||||
<!-- From STDIN To RabbitMQ -->
|
||||
|
||||
<int:channel id="toRabbit" />
|
||||
<int-stream:stdin-channel-adapter id="consoleIn"
|
||||
channel="toRabbit">
|
||||
<int:poller fixed-delay="1000" max-messages-per-poll="1" />
|
||||
</int-stream:stdin-channel-adapter>
|
||||
|
||||
<int-amqp:outbound-channel-adapter channel="toRabbit"
|
||||
amqp-template="amqpTemplate" exchange-name="si.test.exchange"
|
||||
routing-key="si.test.binding"/>
|
||||
<int:channel id="toRabbit" />
|
||||
|
||||
<!-- From RabbitMQ To STDOUT -->
|
||||
<int-amqp:outbound-channel-adapter
|
||||
channel="toRabbit" amqp-template="amqpTemplate" exchange-name="si.test.exchange"
|
||||
routing-key="si.test.binding" />
|
||||
|
||||
<int-amqp:inbound-channel-adapter channel="fromRabbit"
|
||||
queue-names="si.test.queue"
|
||||
connection-factory="connectionFactory" />
|
||||
<!-- From RabbitMQ To STDOUT -->
|
||||
|
||||
<int:channel id="fromRabbit">
|
||||
<int:interceptors>
|
||||
<int:wire-tap channel="loggingChannel"/>
|
||||
</int:interceptors>
|
||||
</int:channel>
|
||||
|
||||
<int-stream:stdout-channel-adapter id="consoleOut" channel="fromRabbit" append-newline="true"/>
|
||||
|
||||
<int:logging-channel-adapter id="loggingChannel" log-full-message="true" level="INFO"/>
|
||||
<int-amqp:inbound-channel-adapter channel="fromRabbit"
|
||||
queue-names="si.test.queue" connection-factory="connectionFactory" />
|
||||
|
||||
<!-- Infrastructure -->
|
||||
<int:channel id="fromRabbit">
|
||||
<int:interceptors>
|
||||
<int:wire-tap channel="loggingChannel" />
|
||||
</int:interceptors>
|
||||
</int:channel>
|
||||
|
||||
<rabbit:connection-factory id="connectionFactory" />
|
||||
<int-stream:stdout-channel-adapter id="consoleOut" channel="fromRabbit"
|
||||
append-newline="true" />
|
||||
|
||||
<rabbit:template id="amqpTemplate" connection-factory="connectionFactory" />
|
||||
<int:logging-channel-adapter id="loggingChannel" log-full-message="true"
|
||||
level="INFO" />
|
||||
|
||||
<rabbit:admin connection-factory="connectionFactory" />
|
||||
<!-- Infrastructure -->
|
||||
|
||||
<rabbit:queue name="si.test.queue" />
|
||||
<rabbit:connection-factory id="connectionFactory" />
|
||||
|
||||
<rabbit:direct-exchange name="si.test.exchange">
|
||||
<rabbit:bindings>
|
||||
<rabbit:binding queue="si.test.queue" key="si.test.binding" />
|
||||
</rabbit:bindings>
|
||||
</rabbit:direct-exchange>
|
||||
<rabbit:template id="amqpTemplate" connection-factory="connectionFactory" />
|
||||
|
||||
<rabbit:admin connection-factory="connectionFactory" />
|
||||
|
||||
<rabbit:queue name="si.test.queue" />
|
||||
|
||||
<rabbit:direct-exchange name="si.test.exchange">
|
||||
<rabbit:bindings>
|
||||
<rabbit:binding queue="si.test.queue" key="si.test.binding" />
|
||||
</rabbit:bindings>
|
||||
</rabbit:direct-exchange>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -4,13 +4,18 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>control-bus</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<name>Samples (Basic) - Control Bus</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
@@ -36,13 +41,13 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -4,16 +4,20 @@
|
||||
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>enricher</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Samples (Basic) - Enricher</name>
|
||||
<url>http://www.springsource.org/spring-integration</url>
|
||||
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
|
||||
@@ -29,7 +33,7 @@
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-eclipse-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<version>2.9</version>
|
||||
<configuration>
|
||||
<additionalProjectnatures>
|
||||
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
|
||||
@@ -44,7 +48,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
@@ -56,7 +60,7 @@
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2</version>
|
||||
<version>1.2.1</version>
|
||||
<configuration>
|
||||
<mainClass>org.springframework.integration.samples.enricher.Main</mainClass>
|
||||
</configuration>
|
||||
@@ -96,7 +100,7 @@
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>1.3.162</version>
|
||||
<version>1.3.168</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>feed</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>feed</artifactId>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<name>Samples (Basic) - Feed Demo (RSS/ATOM)</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.RC2</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
@@ -34,13 +39,13 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.RC2</spring.integration.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
|
||||
@@ -3,13 +3,18 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>ftp</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<name>Samples (Basic) - FTP Demo</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.M1</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
@@ -22,7 +27,7 @@
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.1</version>
|
||||
<version>2.4</version>
|
||||
</dependency>
|
||||
|
||||
<!-- test-scoped dependencies -->
|
||||
@@ -57,13 +62,13 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp-2.1.xsd
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
@@ -29,12 +29,12 @@
|
||||
command-options=""
|
||||
expression="payload"
|
||||
reply-channel="toSplitter"/>
|
||||
|
||||
<int:channel id="toSplitter">
|
||||
<int:interceptors>
|
||||
<int:wire-tap channel="logger"/>
|
||||
</int:interceptors>
|
||||
</int:channel>
|
||||
|
||||
<int:channel id="toSplitter">
|
||||
<int:interceptors>
|
||||
<int:wire-tap channel="logger"/>
|
||||
</int:interceptors>
|
||||
</int:channel>
|
||||
|
||||
<int:logging-channel-adapter id="logger" log-full-message="true"/>
|
||||
|
||||
@@ -45,25 +45,25 @@
|
||||
session-factory="ftpSessionFactory"
|
||||
request-channel="toGet"
|
||||
reply-channel="toRemoveChannel"
|
||||
command="get"
|
||||
command="get"
|
||||
command-options="-P"
|
||||
expression="payload.remoteDirectory + '/' + payload.filename"/>
|
||||
|
||||
<int:channel id="toRemoveChannel">
|
||||
<int:interceptors>
|
||||
<int:wire-tap channel="logger2"/>
|
||||
</int:interceptors>
|
||||
</int:channel>
|
||||
<int:channel id="toRemoveChannel">
|
||||
<int:interceptors>
|
||||
<int:wire-tap channel="logger2"/>
|
||||
</int:interceptors>
|
||||
</int:channel>
|
||||
|
||||
<int:logging-channel-adapter id="logger2" log-full-message="true"/>
|
||||
<int:logging-channel-adapter id="logger2" log-full-message="true"/>
|
||||
|
||||
<int-ftp:outbound-gateway id="gatewayRM"
|
||||
<int-ftp:outbound-gateway id="gatewayRM"
|
||||
session-factory="ftpSessionFactory" cache-sessions="false"
|
||||
expression="headers['file_remoteDirectory'] + '/' + headers['file_remoteFile']"
|
||||
request-channel="toRemoveChannel"
|
||||
command="rm"
|
||||
reply-channel="aggregateResultsChannel"/>
|
||||
|
||||
<int:aggregator input-channel="aggregateResultsChannel"/>
|
||||
<int:aggregator input-channel="aggregateResultsChannel"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -4,30 +4,35 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>helloworld</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<name>Samples (Basic) - Hello World Sample</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
<java.main.class>org.springframework.integration.samples.helloworld.HelloWorldApp</java.main.class>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>hello</id>
|
||||
<properties>
|
||||
<java.main.class>org.springframework.integration.samples.helloworld.HelloWorldApp</java.main.class>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>poller</id>
|
||||
<properties>
|
||||
<java.main.class>org.springframework.integration.samples.helloworld.PollerApp</java.main.class>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>hello</id>
|
||||
<properties>
|
||||
<java.main.class>org.springframework.integration.samples.helloworld.HelloWorldApp</java.main.class>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>poller</id>
|
||||
<properties>
|
||||
<java.main.class>org.springframework.integration.samples.helloworld.PollerApp</java.main.class>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
@@ -53,19 +58,19 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2</version>
|
||||
<version>1.2.1</version>
|
||||
<configuration>
|
||||
<mainClass>${java.main.class}</mainClass>
|
||||
</configuration>
|
||||
|
||||
@@ -3,16 +3,21 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>http</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<name>Samples (Basic) - HTTP Demo</name>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<spring.version>3.1.0.RELEASE</spring.version>
|
||||
<commons-fileupload>1.2</commons-fileupload>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<spring.version>3.1.3.RELEASE</spring.version>
|
||||
<commons-fileupload>1.2.2</commons-fileupload>
|
||||
<commons-io>1.3.2</commons-io>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -43,7 +48,7 @@
|
||||
<dependency>
|
||||
<groupId>javax.mail</groupId>
|
||||
<artifactId>mail</artifactId>
|
||||
<version>1.4.1</version>
|
||||
<version>1.4.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
@@ -56,19 +61,19 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2</version>
|
||||
<version>1.2.1</version>
|
||||
<configuration>
|
||||
<mainClass>org.springframework.integration.samples.http.HttpClientDemo</mainClass>
|
||||
</configuration>
|
||||
@@ -76,7 +81,7 @@
|
||||
<plugin>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>maven-jetty-plugin</artifactId>
|
||||
<version>6.1.10</version>
|
||||
<version>6.1.26</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,9 +18,11 @@ package org.springframework.integration.samples.http;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gunnar Hillert
|
||||
*
|
||||
*/
|
||||
public interface RequestGateway {
|
||||
|
||||
public String echo(String request);
|
||||
String echo(String request);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
Spring Integration - JDBC Sample
|
||||
================================
|
||||
|
||||
# Overview
|
||||
## Overview
|
||||
|
||||
This sample provides example of how the Jdbc Adapters can be used.
|
||||
This sample provides example of how the JDBC Adapters can be used.
|
||||
The example presented covers the following use cases
|
||||
|
||||
* Find a Person detail from the database based on the name provided
|
||||
* Create a new Person record in the table
|
||||
|
||||
The first example demonstrates the use of outbound gateway to search for a person record using the
|
||||
spring integration's jdbc outbound gateway
|
||||
The first example demonstrates the use of *Outbound Gateway* to search for a person record using *Spring Integration*'s *JDBC Outbound Gateway*.
|
||||
|
||||
The second example on other hand demonstrates how the jdbc outbound gateway be used to create a new
|
||||
Person record and then return the newly created Person record.
|
||||
This example demonstrates how to make use of the sql parameter source factory to extract
|
||||
the required values to be inserted/updated/selected in the query provided.
|
||||
The second example on other hand demonstrates how the *JDBC Outbound Gateway* can be used to create a new *Person* record and then return the newly created *Person* record. This example demonstrates how to make use of the sql parameter source factory to extract the required values to be inserted/updated/selected in the query provided.
|
||||
|
||||
# Getting Started
|
||||
## Getting Started
|
||||
|
||||
You can run the application by either
|
||||
|
||||
@@ -26,18 +22,18 @@ You can run the application by either
|
||||
- mvn package
|
||||
- mvn exec:java
|
||||
|
||||
Make an appropriate choice for searching a Person or creating a Person
|
||||
Make an appropriate choice for searching a Person or creating a Person.
|
||||
|
||||
For creating the person record, select the appropriate steps as prompted by the application
|
||||
For creating the person record, select the appropriate steps as prompted by the application.
|
||||
|
||||
On creation of Person records, you may choose the option of selecting the created person records and view their details
|
||||
On creation of *Person* records, you may choose the option of selecting the created person records and view their details.
|
||||
|
||||
#Some details about the sample "Person Outbound Gateway"
|
||||
## Details
|
||||
|
||||
We use the outbound gateway to insert records in a Person table based on the values contained
|
||||
in the message payload that is received over the channel to the adapter.
|
||||
|
||||
The following are used to configure the gateway
|
||||
The following are used to configure the *Gateway*:
|
||||
|
||||
* The request and reply channels
|
||||
* The data source for the database
|
||||
@@ -47,7 +43,7 @@ The following are used to configure the gateway
|
||||
* Optional reply SQL Parameter source factory
|
||||
* RowMapper if you intend to map the ResultSet to your custom object
|
||||
|
||||
The following sequence of events happen when we invoke the createPerson method on the gateway
|
||||
The following sequence of events happen when we invoke the *createPerson* method on the *Gateway*:
|
||||
|
||||
* The parameter of type Person is sent as a payload of a message over the reply-channel
|
||||
* The outbound gateway reads this message and extracts the payload
|
||||
@@ -61,10 +57,12 @@ The following sequence of events happen when we invoke the createPerson method o
|
||||
* The Person object is then sent as a payload of the Message over the reply channel.
|
||||
* The Person payload is extracted from the Message and returned to the calling application.
|
||||
|
||||
For executing the program and see the results, execute the junit test case
|
||||
org.springframework.integration.samples.jdbc.OutboundGatewayTest
|
||||
## Running the Sample
|
||||
|
||||
# Resources
|
||||
For executing the program and see the results, execute the junit test case
|
||||
**org.springframework.integration.samples.jdbc.OutboundGatewayTest**
|
||||
|
||||
## Resources
|
||||
|
||||
For help please take a look at the Spring Integration documentation:
|
||||
|
||||
|
||||
@@ -4,16 +4,20 @@
|
||||
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>jdbc</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Samples (Basic) - JDBC</name>
|
||||
<url>http://www.springsource.org/spring-integration</url>
|
||||
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
|
||||
@@ -29,7 +33,7 @@
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-eclipse-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<version>2.9</version>
|
||||
<configuration>
|
||||
<additionalProjectnatures>
|
||||
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
|
||||
@@ -44,7 +48,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
@@ -56,7 +60,7 @@
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2</version>
|
||||
<version>1.2.1</version>
|
||||
<configuration>
|
||||
<mainClass>org.springframework.integration.samples.jdbc.Main</mainClass>
|
||||
</configuration>
|
||||
@@ -102,7 +106,7 @@
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>1.3.162</version>
|
||||
<version>1.3.168</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -80,14 +80,15 @@ public final class Main {
|
||||
System.out.print("Enter you choice: ");
|
||||
while (true) {
|
||||
final String input = scanner.nextLine();
|
||||
if("1".equals(input.trim()))
|
||||
if("1".equals(input.trim())) {
|
||||
getPersonDetails(scanner, personService);
|
||||
else if("2".equals(input.trim()))
|
||||
} else if("2".equals(input.trim())) {
|
||||
createPersonDetails(scanner,personService);
|
||||
else if("q".equals(input.trim()))
|
||||
} else if("q".equals(input.trim())) {
|
||||
break;
|
||||
else
|
||||
} else {
|
||||
System.out.println("Invalid choice\n\n");
|
||||
}
|
||||
|
||||
System.out.println("Please enter a choice and press <enter>: ");
|
||||
System.out.println("\t1. Find person details");
|
||||
|
||||
@@ -4,24 +4,29 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>jms</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<name>Samples (Basic) - JMS</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<activemq.version>5.5.1</activemq.version>
|
||||
<slf4j.version>1.6.4</slf4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<activemq.version>5.7.0</activemq.version>
|
||||
<slf4j.version>1.7.2</slf4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
@@ -38,33 +43,33 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jms</artifactId>
|
||||
<version>3.1.0.RELEASE</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jms</artifactId>
|
||||
<version>3.1.3.RELEASE</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-core</artifactId>
|
||||
<version>${spring.integration.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-jms</artifactId>
|
||||
<version>${spring.integration.version}</version>
|
||||
</dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-jms</artifactId>
|
||||
<version>${spring.integration.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-stream</artifactId>
|
||||
<version>${spring.integration.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
@@ -72,13 +77,13 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,18 +16,7 @@
|
||||
|
||||
package org.springframework.integration.samples.jms;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
|
||||
/**
|
||||
* A simple bootstrap main() method for starting a pair of JMS Channel
|
||||
@@ -39,6 +28,7 @@ import org.springframework.integration.support.MessageBuilder;
|
||||
* See the configuration in the three XML files that are referenced below.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Gunnar Hillert
|
||||
*/
|
||||
public class ChannelAdapterDemo {
|
||||
|
||||
|
||||
@@ -5,12 +5,17 @@
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>jmx</artifactId>
|
||||
<name>Samples (Basic) - JMX</name>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
@@ -41,13 +46,13 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -11,18 +11,18 @@
|
||||
<url>http://www.springsource.org/spring-integration</url>
|
||||
|
||||
<prerequisites>
|
||||
<maven>2.2.0</maven>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.M2</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
<openjpa.version>2.2.0</openjpa.version>
|
||||
<eclipselink.version>2.3.2</eclipselink.version>
|
||||
<hibernate.version>4.0.1.Final</hibernate.version>
|
||||
<spring-instrument.version>3.1.1.RELEASE</spring-instrument.version>
|
||||
<spring-instrument.version>3.1.3.RELEASE</spring-instrument.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
@@ -49,7 +49,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
@@ -117,7 +117,7 @@
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.6.4</version>
|
||||
<version>1.7.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Embedded Database -->
|
||||
@@ -125,7 +125,7 @@
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>1.3.162</version>
|
||||
<version>1.3.168</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Persistence Provider -->
|
||||
|
||||
@@ -4,11 +4,16 @@
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>mail</artifactId>
|
||||
<name>Samples (Basic) - Mail Demo (IMAP + POP3)</name>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
@@ -26,7 +31,7 @@
|
||||
<dependency>
|
||||
<groupId>javax.mail</groupId>
|
||||
<artifactId>mail</artifactId>
|
||||
<version>1.4.4</version>
|
||||
<version>1.4.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
@@ -45,13 +50,13 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -1,82 +1,68 @@
|
||||
<h3>MongoDb Outbound Channel Adapter</h3>
|
||||
MongoDb Outbound Channel Adapter allows you to write the Message payload to a MongoDb document store.
|
||||
Spring Integration - MongoDb Sample
|
||||
================================
|
||||
|
||||
You can see the simplest configuration of the MongoDb Channel Adapter below:
|
||||
### MongoDb Outbound Channel Adapter
|
||||
|
||||
````
|
||||
<int-mongodb:outbound-channel-adapter id="deafultAdapter"/>
|
||||
````
|
||||
The *MongoDb Outbound Channel Adapter* allows you to write the Message payload to a MongoDb document store. You can see the simplest configuration of the MongoDb Channel Adapter below:
|
||||
|
||||
It will be initialized with the default instance of the <strong>MongoDbFactory</strong> (the default bean name is 'mongoDbFactory') otherwise you can provide its
|
||||
reference via <strong>mongodb-factory</strong> attribute.
|
||||
<int-mongodb:outbound-channel-adapter id="deafultAdapter"/>
|
||||
|
||||
Now you can run the <strong>MongoDbOutboundAdapterDemo</strong>. After running it open terminal window and start MongoDb CLI
|
||||
It will be initialized with the default instance of the **MongoDbFactory** (the default bean name is 'mongoDbFactory') otherwise you can provide its
|
||||
reference via **mongodb-factory** attribute.
|
||||
|
||||
````
|
||||
$> mongo
|
||||
````
|
||||
Now you can run the **MongoDbOutboundAdapterDemo**. After running it open terminal window and start MongoDb CLI
|
||||
|
||||
$ mongo
|
||||
|
||||
Once in MongoDb CLI type a query:
|
||||
|
||||
````
|
||||
> db.data.find({})
|
||||
````
|
||||
> db.data.find({})
|
||||
|
||||
And you should see the 3 document entries we just created:
|
||||
````
|
||||
{ "_id" : ObjectId("505ff83d03649ed6881d066b"), "_class" : "org.springframework.integration.samples.mongodb.domain.Person", "fname" : "John", "lname" : "Doe", "address" : { "street" : "3401 Hillview Ave", "city" : "Palo Alto", "zip" : "94304", "state" : "CA" } }
|
||||
{ "_id" : ObjectId("505ff83d03649ed6881d066c"), "_class" : "org.springframework.integration.samples.mongodb.domain.Person", "fname" : "Josh", "lname" : "Doe", "address" : { "street" : "123 Main st", "city" : "San Francisco", "zip" : "94115", "state" : "CA" } }
|
||||
{ "_id" : ObjectId("505ff83d03649ed6881d066d"), "_class" : "org.springframework.integration.samples.mongodb.domain.Person", "fname" : "Jane", "lname" : "Doe", "address" : { "street" : "2323 Market st", "city" : "Philadelphia", "zip" : "19152", "state" : "PA" } }
|
||||
````
|
||||
Note that our entries were represented by a very simple Java Beans style objects which were converted into JSON string using default converters.
|
||||
|
||||
Let's try to complicate the issue slightly. We are going to try to store a simple coma delimited String in our <strong>MongoDbOutboundAdapterDemo().runSimpleComplexAdapter()</strong> demo:
|
||||
{ "_id" : ObjectId("505ff83d03649ed6881d066b"), "_class" : "org.springframework.integration.samples.mongodb.domain.Person", "fname" : "John", "lname" : "Doe", "address" : { "street" : "3401 Hillview Ave", "city" : "Palo Alto", "zip" : "94304", "state" : "CA" } }
|
||||
{ "_id" : ObjectId("505ff83d03649ed6881d066c"), "_class" : "org.springframework.integration.samples.mongodb.domain.Person", "fname" : "Josh", "lname" : "Doe", "address" : { "street" : "123 Main st", "city" : "San Francisco", "zip" : "94115", "state" : "CA" } }
|
||||
{ "_id" : ObjectId("505ff83d03649ed6881d066d"), "_class" : "org.springframework.integration.samples.mongodb.domain.Person", "fname" : "Jane", "lname" : "Doe", "address" : { "street" : "2323 Market st", "city" : "Philadelphia", "zip" : "19152", "state" : "PA" } }
|
||||
|
||||
````
|
||||
messageChannel.send(new GenericMessage<String>("John Dow, Palo Alto, 3401 Hillview Ave, 94304, CA"));
|
||||
````
|
||||
Note that our entries were represented by a very simple Java Beans style objects which were converted into JSON string using default converters. Let's try to complicate the issue slightly. We are going to try to store a simple coma delimited String in our **MongoDbOutboundAdapterDemo().runSimpleComplexAdapter()** demo:
|
||||
|
||||
messageChannel.send(new GenericMessage<String>("John Dow, Palo Alto, 3401 Hillview Ave, 94304, CA"));
|
||||
|
||||
As you can see we are sending a Message with the String payload which represents a person. Executing this code will result in:
|
||||
````
|
||||
Caused by: java.lang.IllegalArgumentException: can't serialize class java.lang.Character
|
||||
````
|
||||
That is because MongoDb attempts to convert the underlying string using default set of converters that are based on Java Beans convention.
|
||||
In any case that is not what we are looking for in this case anyway since we want to store this object as a document with each field represented individually so we need to parse this string into a set of fields first. To do so we will apply a custom <strong>MongoConverter</strong>. Modify the sample configuration of <strong>simpleAdapterWithConverter</strong> to add a reference to an already configured converter.
|
||||
|
||||
````
|
||||
<int-mongodb:outbound-channel-adapter id="adapterWithConverter"
|
||||
Caused by: java.lang.IllegalArgumentException: can't serialize class java.lang.Character
|
||||
|
||||
That is because MongoDb attempts to convert the underlying string using default set of converters that are based on Java Beans convention.
|
||||
In any case that is not what we are looking for in this case anyway since we want to store this object as a document with each field represented individually so we need to parse this string into a set of fields first. To do so we will apply a custom **MongoConverter**. Modify the sample configuration of **simpleAdapterWithConverter** to add a reference to an already configured converter.
|
||||
|
||||
<int-mongodb:outbound-channel-adapter id="adapterWithConverter"
|
||||
mongo-converter="stringConverter"/>
|
||||
````
|
||||
|
||||
Run the demo again and you'll see that it will succeed this time and you should see the stored object as:
|
||||
````
|
||||
{ "_id" : ObjectId("505ffeac0364f8a92337657e"), "fname" : "John", "lname" : "Dow", "address" : { "city" : "Palo Alto", "street" : "3401 Hillview Ave", "zip" : "94304", "state" : "CA" } }
|
||||
````
|
||||
|
||||
{ "_id" : ObjectId("505ffeac0364f8a92337657e"), "fname" : "John", "lname" : "Dow", "address" : { "city" : "Palo Alto", "street" : "3401 Hillview Ave", "zip" : "94304", "state" : "CA" } }
|
||||
|
||||
This time the conversion is done using a provided converter and you can see in the StringConverter.write(..) method that all that we are doing is parsing the input String and adding its data as an individual fields to an instance of the DBObject.
|
||||
|
||||
For even more complex scenarios you can also bootstrap the adapter with the custom instance of the <strong>MongoTemplate</strong>, but its out of scope of this blog.
|
||||
For even more complex scenarios you can also bootstrap the adapter with the custom instance of the **MongoTemplate**, but its out of scope of this blog.
|
||||
|
||||
<h3>MongoDb Inbound Channel Adapter</h3>
|
||||
MongoDb Inbound Channel Adapter allows you to read documents from the MongoDb and send them as Message payloads downstream.
|
||||
### MongoDb Inbound Channel Adapter<
|
||||
|
||||
This simple example shows you how to read the documents stored in the MongoDb. For this example we'll use data stored by the MongoDb Outbound Channel Adapter discussed in the previous section.
|
||||
MongoDb Inbound Channel Adapter allows you to read documents from the MongoDb and send them as Message payloads downstream. This simple example shows you how to read the documents stored in the MongoDb. For this example we'll use data stored by the MongoDb Outbound Channel Adapter discussed in the previous section.
|
||||
As you can see from the example below, the configuration of MongoDb Inbound Channel Adapter is very similar to any other polling Inbound Channel Adapter.
|
||||
|
||||
````
|
||||
<int-mongodb:inbound-channel-adapter id="simpleInboundAdapter" channel="splittingChannel"
|
||||
<int-mongodb:inbound-channel-adapter id="simpleInboundAdapter" channel="splittingChannel"
|
||||
query="{address.state : 'CA'}">
|
||||
<int:poller fixed-rate="60000" max-messages-per-poll="1"/>
|
||||
</int-mongodb:inbound-channel-adapter>
|
||||
````
|
||||
</int-mongodb:inbound-channel-adapter>
|
||||
|
||||
Notice the <strong>query</strong> attribute which allows you to provide JSON queries represented as simple String. For more information on MongoDb queries please refer to <a href="http://www.mongodb.org/display/DOCS/Querying">MongoDb documentation</a>
|
||||
In the above case we are selecting all documents where <i>state</i> element of the <i>address</i> element is <b>'CA'</b>. As you may have guessed the MongoDb Inbound Channel Adapter returns List by default, so you can easily configure a very basic splitter downstream (as in this example) to process one message at the time. Run the <strong>MongoDbInboundAdapterDemo</strong> and you should see the results in the console:
|
||||
Notice the **query** attribute which allows you to provide JSON queries represented as simple String. For more information on MongoDb queries please refer to [MongoDb documentation](http://www.mongodb.org/display/DOCS/Querying)
|
||||
In the above case we are selecting all documents where *state* element of the *address* element is **'CA'**. As you may have guessed the MongoDb Inbound Channel Adapter returns List by default, so you can easily configure a very basic splitter downstream (as in this example) to process one message at the time. Run the **MongoDbInboundAdapterDemo** and you should see the results in the console:
|
||||
|
||||
````
|
||||
04:37:30.720 WARN . . . { "_id" : { "$oid" : "50601bca0364063859066bcd"} , "_class" : "org.springframework.integration.samples.mongodb.domain.Person" , "fname" : "John" , "lname" : "Doe" , "address" : { "street" : "3401 Hillview Ave" , "city" : "Palo Alto" , "zip" : "94304" , "state" : "CA"}}
|
||||
04:37:30.722 WARN . . . { "_id" : { "$oid" : "50601bca0364063859066bce"} , "_class" : "org.springframework.integration.samples.mongodb.domain.Person" , "fname" : "Josh" , "lname" : "Doe" , "address" : { "street" : "123 Main st" , "city" : "San Francisco" , "zip" : "94115" , "state" : "CA"}}
|
||||
````
|
||||
However, if you know that your query can only return a single result you can avoid returning List by configuring <strong>expect-single-result</strong> attribute setting its value to 'true'.
|
||||
04:37:30.720 WARN . . . { "_id" : { "$oid" : "50601bca0364063859066bcd"} , "_class" : "org.springframework.integration.samples.mongodb.domain.Person" , "fname" : "John" , "lname" : "Doe" , "address" : { "street" : "3401 Hillview Ave" , "city" : "Palo Alto" , "zip" : "94304" , "state" : "CA"}}
|
||||
04:37:30.722 WARN . . . { "_id" : { "$oid" : "50601bca0364063859066bce"} , "_class" : "org.springframework.integration.samples.mongodb.domain.Person" , "fname" : "Josh" , "lname" : "Doe" , "address" : { "street" : "123 Main st" , "city" : "San Francisco" , "zip" : "94115" , "state" : "CA"}}
|
||||
|
||||
Also, you may wish to do some post-processing to the successfully processed data that was read from the MongoDb.
|
||||
For example; you may want to move or remove a document after its been processed.
|
||||
You can do this using Transaction Synchronization feature that was added with Spring Integration 2.2 and which will be discussed in the next blog in this series expected in a few days (from Gary Russell). However the impatient once can get more details now by reading MongoDb Inbound Channel Adapter section of the reference manual <a href="http://static.springsource.org/spring-integration/docs/2.2.0.RC1/reference/htmlsingle/#mongodb-inbound-channel-adapter">http://static.springsource.org/spring-integration/docs/2.2.0.RC1/reference/htmlsingle/#mongodb-inbound-channel-adapter</a>
|
||||
However, if you know that your query can only return a single result you can avoid returning List by configuring **expect-single-result** attribute setting its value to *true*.
|
||||
|
||||
Also, you may wish to do some post-processing to the successfully processed data that was read from the MongoDb. For example; you may want to move or remove a document after its been processed.
|
||||
You can do this using Transaction Synchronization feature that was added with *Spring Integration 2.2* and which will be discussed in the next blog in this series expected in a few days (from Gary Russell). However the impatient once can get more details now by reading MongoDb Inbound Channel Adapter section of the reference manual [http://static.springsource.org/spring-integration/docs/2.2.0.RC3/reference/htmlsingle/#mongodb-inbound-channel-adapter](http://static.springsource.org/spring-integration/docs/2.2.0.RC3/reference/htmlsingle/#mongodb-inbound-channel-adapter).
|
||||
|
||||
@@ -4,16 +4,20 @@
|
||||
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>mongodb</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Samples (Basic) - MongoDb</name>
|
||||
<url>http://www.springsource.org/spring-integration</url>
|
||||
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.RC1</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
|
||||
@@ -29,7 +33,7 @@
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-eclipse-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<version>2.9</version>
|
||||
<configuration>
|
||||
<additionalProjectnatures>
|
||||
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
|
||||
@@ -44,7 +48,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
@@ -56,49 +60,12 @@
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2</version>
|
||||
<version>1.2.1</version>
|
||||
<configuration>
|
||||
<mainClass>org.springframework.integration.samples.jdbc.Main</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<!--This plugin's configuration is used to store Eclipse m2e settings
|
||||
only. It has no influence on the Maven build itself. -->
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
<artifactId>lifecycle-mapping</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<configuration>
|
||||
<lifecycleMappingMetadata>
|
||||
<pluginExecutions>
|
||||
<pluginExecution>
|
||||
<pluginExecutionFilter>
|
||||
<groupId>
|
||||
org.apache.maven.plugins
|
||||
</groupId>
|
||||
<artifactId>
|
||||
maven-compiler-plugin
|
||||
</artifactId>
|
||||
<versionRange>
|
||||
[2.3.2,)
|
||||
</versionRange>
|
||||
<goals>
|
||||
<goal>testCompile</goal>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<ignore></ignore>
|
||||
</action>
|
||||
</pluginExecution>
|
||||
</pluginExecutions>
|
||||
</lifecycleMappingMetadata>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
|
||||
|
||||
<mongo:db-factory id="mongoDbFactory" dbname="test"/>
|
||||
|
||||
|
||||
<int-mongodb:outbound-channel-adapter id="deafultAdapter" />
|
||||
|
||||
<int-mongodb:outbound-channel-adapter id="adapterWithConverter"/>
|
||||
|
||||
<int-mongodb:outbound-channel-adapter id="adapterWithConverter" mongo-converter="stringConverter"/>
|
||||
|
||||
<!-- mongo-converter="stringConverter" -->
|
||||
|
||||
|
||||
<bean id="stringConverter" class="org.springframework.integration.samples.mongodb.util.StringConverter">
|
||||
<constructor-arg ref="mongoDbFactory"/>
|
||||
<constructor-arg>
|
||||
|
||||
@@ -1,77 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>oddeven</artifactId>
|
||||
<name>Samples (Basic) - Odd-Even Sample</name>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>oddeven</artifactId>
|
||||
<name>Samples (Basic) - Odd-Even Sample</name>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>cron</id>
|
||||
<properties>
|
||||
<java.main.class>org.springframework.integration.samples.oddeven.CronOddEvenDemo</java.main.class>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>interval</id>
|
||||
<properties>
|
||||
<java.main.class>org.springframework.integration.samples.oddeven.IntervalOddEvenDemoTestApp</java.main.class>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-core</artifactId>
|
||||
<version>${spring.integration.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
<!-- test-scoped dependencies -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2</version>
|
||||
<configuration>
|
||||
<mainClass>${java.main.class}</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>cron</id>
|
||||
<properties>
|
||||
<java.main.class>org.springframework.integration.samples.oddeven.CronOddEvenDemo</java.main.class>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>interval</id>
|
||||
<properties>
|
||||
<java.main.class>org.springframework.integration.samples.oddeven.IntervalOddEvenDemoTestApp</java.main.class>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-core</artifactId>
|
||||
<version>${spring.integration.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
<!-- test-scoped dependencies -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<configuration>
|
||||
<mainClass>${java.main.class}</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>repo.springsource.org.milestone</id>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration-2.1.xsd">
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd">
|
||||
|
||||
<annotation-config/>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>basic-samples</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<name>Spring Integration Samples - Basic</name>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@ Quote Sample
|
||||
This example demonstrates the following aspects of the CORE EIP support available with Spring Integration:
|
||||
|
||||
1. Channel Adapter (Inbound and Stdout)
|
||||
2. Poller with Interval Trigers
|
||||
2. Poller with Interval Triggers
|
||||
3. Service Activator
|
||||
|
||||
It is a very simple example that introduces you to the Channel adapters and Pollers.
|
||||
It is a very simple example that introduces you to Channel adapters and Pollers.
|
||||
|
||||
Messages are simply being emitted by the Poller (interval based) triggering **nextTicker()** method of *TickerStream* class and sent to a **tickers** channel from which they are retrieved by the *TickerStream* service.
|
||||
Messages are simply being emitted by the *Poller* (interval based) triggering the **nextTicker()** method of the *TickerStream* class and are then sent to a **tickers** channel, from which they are retrieved by the *TickerStream* service.
|
||||
|
||||
*TickerStream* service generates random ticker symbols sending them to the **quotes** channel from which they are retrieved by the *QuoteService* (annotation based Service Activator). *QuoteService* generates random quotes sending them to the *Stdout Channel Adapter* where they are printed to a console.
|
||||
The *TickerStream* service generates random ticker symbols, sending them to the **quotes** channel, from which they are retrieved by the *QuoteService* (annotation based Service Activator). The *QuoteService* generates random quotes, sending them to the *Stdout Channel Adapter*, where they are printed to the console.
|
||||
|
||||
To execute sample simply run **QuoteDemoTest**. You should see the output similar to this:
|
||||
|
||||
|
||||
@@ -5,12 +5,15 @@
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>quote</artifactId>
|
||||
<name>Samples (Basic) - Quote Sample</name>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
@@ -36,13 +39,13 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -68,4 +68,4 @@ This sample uses a property **private.keyfile** to point to the location of your
|
||||
>$ chmod 600 ~/.ssh/authorized_keys
|
||||
|
||||
* Then edit **authorized_keys** file and paste in the contents of the public key file **sftp_rsa.pub**.
|
||||
* Move your private key file **sftp_rsa** to META-INF/keys directory
|
||||
* Move your private key file **sftp_rsa** to the directory **/src/test/resources/META-INF/keys/** directory.
|
||||
|
||||
@@ -3,13 +3,16 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>sftp</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<name>Samples (Basic) - SFTP Demo</name>
|
||||
<packaging>jar</packaging>
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
@@ -35,13 +38,13 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
<property name="port" value="22"/>
|
||||
<property name="user" value="${user}"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<int-sftp:inbound-channel-adapter id="sftpInbondAdapter"
|
||||
channel="receiveChannel"
|
||||
session-factory="sftpSessionFactory"
|
||||
channel="receiveChannel"
|
||||
session-factory="sftpSessionFactory"
|
||||
local-directory="file:local-dir"
|
||||
remote-directory="<<SPECIFY REMOTE DIRECTORY (e.g., /{workspace}/samples/basic/sftp/remote-target-dir)>>"
|
||||
auto-create-local-directory="true"
|
||||
@@ -31,9 +31,9 @@
|
||||
filename-regex=".*\.txt$">
|
||||
<int:poller fixed-rate="1000" max-messages-per-poll="1"/>
|
||||
</int-sftp:inbound-channel-adapter>
|
||||
|
||||
|
||||
<int:channel id="receiveChannel">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
expression="headers['file_remoteDirectory'] + '/' + headers['file_remoteFile']"
|
||||
request-channel="toRm"
|
||||
command="rm"/>
|
||||
|
||||
|
||||
<int:aggregator input-channel="aggregateResultsChannel"/>
|
||||
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
http://www.springframework.org/schema/integration/sftp http://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd">
|
||||
|
||||
<context:property-placeholder location="classpath:user.properties"/>
|
||||
|
||||
|
||||
<bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
|
||||
<property name="host" value="localhost"/>
|
||||
<property name="privateKey" value="classpath:META-INF/keys/sftp_rsa"/>
|
||||
@@ -18,13 +18,13 @@
|
||||
<property name="port" value="22"/>
|
||||
<property name="user" value="${user}"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<int:channel id="inputChannel"/>
|
||||
|
||||
|
||||
<int-sftp:outbound-channel-adapter id="sftpOutboundAdapter"
|
||||
session-factory="sftpSessionFactory"
|
||||
channel="inputChannel"
|
||||
remote-filename-generator-expression="payload.getName() + '_foo'"
|
||||
remote-directory="<SPECIFY REMOTE DIRECTORY (e.g., /{workspace}/samples/basic/sftp/remote-target-dir)>"/>
|
||||
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -5,7 +5,7 @@ Spring Integration - TCP-AMQP Sample
|
||||
|
||||
This sample demonstrates basic functionality of bridging **Spring Integration TCP Adapters** with **Spring Integration AMQP Adapters**.
|
||||
|
||||
Once the application is started, you enter some text in a telnet session and the data is written to an AMQP queue, which is then consumed and the result echoed to a netcat session.
|
||||
Once the application is started, you enter some text in a telnet session and the data is written to an AMQP queue, which is then consumed and the result echoed to a [netcat][] session.
|
||||
|
||||
telnet->tcp-inbound-adapter->rabbit->tcp-outbound-adapter->netcat
|
||||
|
||||
@@ -16,6 +16,14 @@ netcat: http://en.wikipedia.org/wiki/Netcat
|
||||
|
||||
# How to Run the Sample
|
||||
|
||||
## Start netcat
|
||||
|
||||
In a terminal window start [netcat][], listening on port *11112*:
|
||||
|
||||
netcat -l -p 11112
|
||||
|
||||
## Start the Application
|
||||
|
||||
If you imported the example into your IDE, you can just run class **org.springframework.integration.samples.tcpamqp.Main**. For example in [SpringSource Tool Suite](http://www.springsource.com/developer/sts) (STS) do:
|
||||
|
||||
* Right-click on Main class --> Run As --> Java Application
|
||||
@@ -24,15 +32,13 @@ Alternatively, you can start the sample from the command line ([Maven](http://ma
|
||||
|
||||
* mvn exec:java
|
||||
|
||||
In another terminal start netcat, listening on port 11112
|
||||
## Run Telnet
|
||||
|
||||
netcat -l 11112
|
||||
|
||||
In another terminat, telnet to localhost:11111
|
||||
In another terminal window, telnet to localhost:11111
|
||||
|
||||
telnet localhost 11111
|
||||
|
||||
Data typed into the telnet terminal will be echoed to the netcat terminal, via the rabbit queue.
|
||||
Data typed into the telnet terminal will be echoed to the [netcat][] terminal, via the rabbit queue.
|
||||
|
||||
# Used Spring Integration components
|
||||
|
||||
@@ -52,3 +58,5 @@ Some further resources:
|
||||
|
||||
* RabbitMQ - [http://www.rabbitmq.com/](http://www.rabbitmq.com/)
|
||||
* Spring AMQP - [http://www.springsource.org/spring-amqp](http://www.springsource.org/spring-amqp)
|
||||
|
||||
[netcat]: http://en.wikipedia.org/wiki/Netcat
|
||||
@@ -1,21 +1,26 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>tcp-amqp</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>tcp-amqp</artifactId>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Samples (Basic) - TCP-AMQP</name>
|
||||
<url>http://www.springsource.org/spring-integration</url>
|
||||
<name>Samples (Basic) - TCP-AMQP</name>
|
||||
<url>http://www.springsource.org/spring-integration</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<slf4j.version>1.6.4</slf4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.amqp.version>1.1.3.RELEASE</spring.amqp.version>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<slf4j.version>1.6.4</slf4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
@@ -25,109 +30,109 @@
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-eclipse-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<configuration>
|
||||
<additionalProjectnatures>
|
||||
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
|
||||
</additionalProjectnatures>
|
||||
<additionalBuildcommands>
|
||||
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
|
||||
</additionalBuildcommands>
|
||||
<downloadSources>true</downloadSources>
|
||||
<downloadJavadocs>true</downloadJavadocs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2</version>
|
||||
<configuration>
|
||||
<mainClass>org.springframework.integration.samples.tcpamqp.Main</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-eclipse-plugin</artifactId>
|
||||
<version>2.9</version>
|
||||
<configuration>
|
||||
<additionalProjectnatures>
|
||||
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
|
||||
</additionalProjectnatures>
|
||||
<additionalBuildcommands>
|
||||
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
|
||||
</additionalBuildcommands>
|
||||
<downloadSources>true</downloadSources>
|
||||
<downloadJavadocs>true</downloadJavadocs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<configuration>
|
||||
<mainClass>org.springframework.integration.samples.tcpamqp.Main</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependencies>
|
||||
|
||||
<!-- Testing -->
|
||||
<!-- Testing -->
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Integration -->
|
||||
<!-- Spring Integration -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-core</artifactId>
|
||||
<version>${spring.integration.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-core</artifactId>
|
||||
<version>${spring.integration.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-amqp</artifactId>
|
||||
<version>${spring.integration.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-amqp</artifactId>
|
||||
<version>${spring.integration.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-groovy</artifactId>
|
||||
<version>${spring.integration.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-groovy</artifactId>
|
||||
<version>${spring.integration.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-ip</artifactId>
|
||||
<version>${spring.integration.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.amqp</groupId>
|
||||
<artifactId>spring-rabbit</artifactId>
|
||||
<version>1.0.1.BUILD-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-ip</artifactId>
|
||||
<version>${spring.integration.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.amqp</groupId>
|
||||
<artifactId>spring-rabbit</artifactId>
|
||||
<version>${spring.amqp.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Logging -->
|
||||
<!-- Logging -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>log4j-over-slf4j</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>log4j-over-slf4j</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<int:channel id="toRabbit" />
|
||||
|
||||
<int-amqp:outbound-channel-adapter channel="toRabbit"
|
||||
amqp-template="amqpTemplate" exchange-name="si.test.exchange"
|
||||
amqp-template="amqpTemplate" exchange-name="si.test.exchange"
|
||||
routing-key="si.test.binding"/>
|
||||
|
||||
<!-- From RabbitMQ To STDOUT -->
|
||||
@@ -29,26 +29,26 @@
|
||||
queue-names="si.test.queue"
|
||||
connection-factory="connectionFactory" />
|
||||
|
||||
<int:channel id="fromRabbit" />
|
||||
<int:channel id="fromRabbit" />
|
||||
|
||||
<int-ip:tcp-connection-factory id="client" type="client" host="localhost" port="11112"/>
|
||||
|
||||
<int-ip:tcp-outbound-channel-adapter channel="fromRabbit" connection-factory="client"/>
|
||||
|
||||
<!-- Infrastructure -->
|
||||
<int-ip:tcp-outbound-channel-adapter channel="fromRabbit" connection-factory="client"/>
|
||||
|
||||
<rabbit:connection-factory id="connectionFactory" />
|
||||
<!-- Infrastructure -->
|
||||
|
||||
<rabbit:template id="amqpTemplate" connection-factory="connectionFactory" />
|
||||
<rabbit:connection-factory id="connectionFactory" />
|
||||
|
||||
<rabbit:admin connection-factory="connectionFactory" />
|
||||
<rabbit:template id="amqpTemplate" connection-factory="connectionFactory" />
|
||||
|
||||
<rabbit:queue name="si.test.queue" />
|
||||
<rabbit:admin connection-factory="connectionFactory" />
|
||||
|
||||
<rabbit:direct-exchange name="si.test.exchange">
|
||||
<rabbit:bindings>
|
||||
<rabbit:binding queue="si.test.queue" key="si.test.binding" />
|
||||
</rabbit:bindings>
|
||||
</rabbit:direct-exchange>
|
||||
<rabbit:queue name="si.test.queue" />
|
||||
|
||||
<rabbit:direct-exchange name="si.test.exchange">
|
||||
<rabbit:bindings>
|
||||
<rabbit:binding queue="si.test.queue" key="si.test.binding" />
|
||||
</rabbit:bindings>
|
||||
</rabbit:direct-exchange>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
TCP Sample
|
||||
==========
|
||||
|
||||
This is a place to get started with the Transmission Control Protocol (TCP). It demonstrates a simple message flow represented by the diagram below:
|
||||
This is a place to get started with the [Transmission Control Protocol][] (TCP). It demonstrates a simple message flow represented by the diagram below:
|
||||
|
||||
Gateway -> Channel -> TcpOutboundGateway -> <===Socket===> -> TcpInboundGateway -> Channel -> ServiceActivator
|
||||
|
||||
The service returns a response which the inbound gateway sends back over the socket to the outbound gateway and the result is returned to the client that invoked the original SimpleGateway method.
|
||||
The service returns a response which the *Inbound Gateway* sends back over the socket to the *Outbound Gateway* and the result is returned to the client that invoked the original **SimpleGateway** method.
|
||||
|
||||
To run sample simply execute a test case in **org.springframework.integration.samples.tcpclientservice** package.
|
||||
## Running the Sample
|
||||
|
||||
Note that the test case includes an alternative configuration that uses the in-built conversion service and the channel dataType attribute, instead of explicit transformers, to convert from byte arrays to Strings.
|
||||
To run sample simply execute a test case in the **org.springframework.integration.samples.tcpclientserver** package.
|
||||
|
||||
Simply change the @ContextConfiguration to switch between the two techniques. In addition, a simple telnet server is provided; see **TelnetServer** in src/main/java. Run this class as a Java application and then use telnet to connect to the service (**telnet localhost 11111**).
|
||||
Note that the test case includes an alternative configuration that uses the built-in *conversion service* and the channel *dataType* attribute, instead of explicit *Transformers*, to convert from byte arrays to Strings.
|
||||
|
||||
Simply change the *@ContextConfiguration* to switch between the two techniques. In addition, a simple telnet server is provided; see **TelnetServer** in *src/main/java*. Run this class as a Java application and then use `telnet` to connect to the service (**telnet localhost 11111**).
|
||||
|
||||
Messages sent will be returned, preceded by 'echo:'.
|
||||
|
||||
@@ -28,7 +30,7 @@ Messages sent will be returned, preceded by 'echo:'.
|
||||
telnet> quit
|
||||
Connection closed.
|
||||
|
||||
Note that the test case also demonstrates error handling on an inbound gateway using direct channels. If the payload is 'FAIL', the EchoService throws an exception. The gateway is configured with an error-channel attribute. Messages sent to that channel are consumed by a transformer that concatenates the inbound message payload with the message text from the thrown exception, returning **FAIL:Failure Demonstration** over the TCP socket.
|
||||
>Note that the test case also demonstrates error handling on an inbound gateway using direct channels. If the payload is 'FAIL', the EchoService throws an exception. The gateway is configured >with an error-channel attribute. Messages sent to that channel are consumed by a transformer that concatenates the inbound message payload with the message text from the thrown exception, >returning **FAIL:Failure Demonstration** over the TCP socket.
|
||||
|
||||
This can also be demonstrated with the telnet client thus...
|
||||
|
||||
@@ -47,8 +49,10 @@ This can also be demonstrated with the telnet client thus...
|
||||
telnet> quit
|
||||
Connection closed.
|
||||
|
||||
A third option exists for converting a stream of bytes to a domain object or message payload. You can hook up different serializers/deserializers at the connection factory which will apply the conversions right when the stream comes in to the gateway and right when it goes out.
|
||||
A third option exists for converting a stream of bytes to a domain object or message payload. You can hook up different serializers/deserializers at the connection factory which will apply the conversions right when the stream comes in to the *Gateway* and right when it goes out.
|
||||
|
||||
See **TcpServerConnectionDeserializeTest** for using a simple (comes with spring) Stx/Etx serializer.
|
||||
|
||||
See **TcpServerCustomSerializerTest** for creating and using your own serializers
|
||||
See **TcpServerCustomSerializerTest** for creating and using your own serializers
|
||||
|
||||
[Transmission Control Protocol]: http://en.wikipedia.org/wiki/Transmission_Control_Protocol
|
||||
@@ -4,14 +4,17 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>tcp-client-server</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<name>Samples (Basic) - TCP Client Server Sample</name>
|
||||
<packaging>jar</packaging>
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.version>3.1.0.RELEASE</spring.version>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.version>3.1.3.RELEASE</spring.version>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
@@ -47,25 +50,24 @@
|
||||
<version>${spring.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -4,14 +4,17 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>testing-examples</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<name>Samples (Basic) - Testing Examples</name>
|
||||
<packaging>jar</packaging>
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<spring.version>3.1.0.RELEASE</spring.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<spring.version>3.1.3.RELEASE</spring.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
@@ -67,62 +70,62 @@
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>spring-expression</artifactId>
|
||||
<groupId>org.springframework</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-oxm</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>spring-expression</artifactId>
|
||||
<groupId>org.springframework</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-oxm</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<testResources>
|
||||
<testResource>
|
||||
<directory>src/test/java</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<directory>src/test/resources</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<directory>src/test/java</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<directory>src/test/resources</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
</testResource>
|
||||
</testResources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.11</version>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>**/*Tests.java</include>
|
||||
</includes>
|
||||
</configuration>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12.4</version>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>**/*Tests.java</include>
|
||||
</includes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
@@ -133,4 +136,4 @@
|
||||
<url>https://repo.springsource.org/libs-milestone</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
</project>
|
||||
</project>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,11 +19,12 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Gary Russell
|
||||
* @author Gunnar Hillert
|
||||
* @since 2.0.2
|
||||
*
|
||||
*/
|
||||
public interface WeatherAndTraffic {
|
||||
|
||||
public List<String> getByZip(String zip);
|
||||
|
||||
List<String> getByZip(String zip);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,11 +20,13 @@ import org.springframework.integration.file.FileHeaders;
|
||||
|
||||
/**
|
||||
* @author Gary Russell
|
||||
* @author Gunnar Hillert
|
||||
*
|
||||
* @since 2.0.2
|
||||
*
|
||||
*/
|
||||
public interface VoidGateway {
|
||||
|
||||
|
||||
public void process(String thing, @Header(FileHeaders.FILENAME) String fileName);
|
||||
|
||||
}
|
||||
|
||||
@@ -7,23 +7,23 @@ This example demonstrates the following aspects of the Twitter support available
|
||||
2. Twitter Inbound Search Channel Adapter - allows you to receive HOME status updates
|
||||
3. Twitter Outboud Channel Adapter - allows send status updates
|
||||
|
||||
In order to run this sample you need to configure OAuth and set the values in the OAuth properties.
|
||||
In order to run this sample you need to configure [OAuth][] and set the values in the [OAuth][] properties.
|
||||
|
||||
To use OAuth authentication/authorization with Twitter you must create new Application on Twitter Developers site.
|
||||
Follow the directions below to create a new application and obtain consumer keys and access token:
|
||||
To use [OAuth][] authentication/authorization with Twitter you must create a new Application on the Twitter Developers site.
|
||||
Follow the directions below to create a new application and obtain the consumer keys and the access token:
|
||||
|
||||
* Go to http://dev.twitter.com/
|
||||
* Click on 'Create an app' link and fill out all required fields on the form provided;
|
||||
* Set 'Application Type' to 'Client' and depending on the nature of your application
|
||||
* Select 'Default Access Type' as 'Read & Write' or 'Read-only'
|
||||
* Go to [http://dev.twitter.com/](http://dev.twitter.com/)
|
||||
* Log in to your account
|
||||
* Go to *My applications*.
|
||||
* Click on 'Create a new application' link and fill out all required fields on the form provided;
|
||||
* Submit the form.
|
||||
* If everything is successful you'll be presented with the 'Consumer Key' and 'Consumer Secret'.
|
||||
* Copy both values in the safe place.
|
||||
* On the same page you should see 'My Access Token' button on the side bar (right).
|
||||
* Copy both values to a safe place.
|
||||
* On the same page you should see 'My Access Token' button on bottom of the page.
|
||||
* Click on it and you'll be presented with two more values: 'Access Token' and 'Access Token Secret'.
|
||||
* Copy these values in a safe place as well.
|
||||
* Copy these values to a safe place as well.
|
||||
|
||||
When done fill out **oauth.properties** file so it looks similar to this.
|
||||
When done, fill out **oauth.properties** file so it looks similar to this.
|
||||
|
||||
twitter.oauth.consumerKey=4XzBPabcJQxyBzzzH3TrRQ
|
||||
twitter.oauth.consumerSecret=ab2piKdMfPu8bVa3ab6DAIvIWEVZyMDL0RSEN2I8
|
||||
@@ -32,5 +32,7 @@ When done fill out **oauth.properties** file so it looks similar to this.
|
||||
|
||||
NOTE: the above values are not real ;)
|
||||
|
||||
Now you ready to execute samples. Just run each sample and look for the output produced by the inbound adapters (**TwitterSearchSample.java** and **TwitterTimelineUpdateSample.java**)
|
||||
Now you are ready to execute the samples. Just run each sample and look for the output produced by the inbound adapters (**TwitterSearchSample.java** and **TwitterTimelineUpdateSample.java**)
|
||||
The outbound adapter sample (**TwitterSendUpdatesSample.java**) will not produce any output. Instead within seconds you should see your tweet.
|
||||
|
||||
[OAuth]: http://en.wikipedia.org/wiki/OAuth
|
||||
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>twitter</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<name>Samples (Basic) - Twitter Demo</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.3.RELEASE</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
@@ -41,11 +41,11 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
Web Service Inbound Gateway Sample
|
||||
==================================
|
||||
|
||||
This sample demonstrates a barebones *inbound Web Service Gateway*. Take a look at **web.xml** in the WEB-INF directory where the Spring Web Services Message-dispatching Servlet is defined. Then have a look at the **spring-ws-config.xml** file (also in the WEB-INF directory) where the Spring WS EndpointMapping is defined. Finally view the Spring Integration configuration in the **inbound-gateway-config.xml** file within the **org.springframework.integration.samples.ws** package where the actual gateway is defined along with a channel and service-activator.
|
||||
This sample demonstrates a barebones *inbound Web Service Gateway*. Take a look at **web.xml** in the **WEB-INF** directory where the [Spring Web Services][] Message-dispatching Servlet is defined. Then have a look at the **spring-ws-config.xml** file (also in the **WEB-INF** directory) where the Spring WS EndpointMapping is defined. Finally, view the *Spring Integration* configuration in the **inbound-gateway-config.xml** file within the **org.springframework.integration.samples.ws** package where the actual *Gateway* is defined along with a *Channel* and *Service Activator*.
|
||||
|
||||
To use the gateway, you can run the tests that are located within the **src/test/java** directory. One is for standalone testing of the gateway itself, while the other tests the gateway running on a web server. The latter uses Spring Web Services' client-side support. Alternatively, you can simply start the server, and then send invocations with any standalone HTTP client testing tool. The request format should be similar to the following and should be POSTed to the service URL (e.g. http://localhost:8080/ws-inbound-gateway/echoservice):
|
||||
To use the *Gateway*, you can run the tests that are located within the **src/test/java** directory. One is for standalone testing of the gateway itself, while the other tests the *Gateway* running on a web server. The latter uses [Spring Web Services][]' client-side support. Alternatively, you can simply start the server, and then send invocations with any standalone HTTP client testing tool. The request format should be similar to the following and should be *POST*ed to the service URL (e.g. http://localhost:8080/ws-inbound-gateway/echoservice):
|
||||
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<SOAP-ENV:Header/>
|
||||
@@ -11,3 +11,5 @@ To use the gateway, you can run the tests that are located within the **src/test
|
||||
<echoRequest xmlns="http://www.springframework.org/spring-ws/samples/echo">hello</echoRequest>
|
||||
</SOAP-ENV:Body>
|
||||
</SOAP-ENV:Envelope>
|
||||
|
||||
[Spring Web Services]: http://www.springsource.org/spring-web-services
|
||||
@@ -5,13 +5,16 @@
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>ws-inbound-gateway</artifactId>
|
||||
<name>Samples (Basic) - WS Inbound Gateway Sample</name>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<spring.version>3.1.0.RELEASE</spring.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<spring.version>3.1.3.RELEASE</spring.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
@@ -47,13 +50,13 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -1,20 +1,26 @@
|
||||
WS Outbound Gateway Sample
|
||||
==========================
|
||||
|
||||
This example demonstrates the following aspects of the WS support available with Spring Integration:
|
||||
This example demonstrates the following aspects of the Web Services (WS) support available with *Spring Integration*:
|
||||
|
||||
1. WS Outbound Gateway
|
||||
2. Content Enricher
|
||||
3. Composed Message Processor
|
||||
|
||||
A very simple example that show you how easy it is to invoke a SOAP based service using Spring Integration.
|
||||
A very simple example that show you how easy it is to invoke a service based on the [Simple Object Access Protocol][] (SOAP) using *Spring Integration*.
|
||||
|
||||
* A Message is simply sent to a channel, where it is retrieved by a *Chain* which consists of a *Header Enricher* and a *WS Outbound Gateway*.
|
||||
* The *Header Enricher* enriches the Message with the SOAP action header.
|
||||
* The *WS Outbound Gateway* converts the Message to a SOAP request and sends it to a remote service, which converts a temperature from
|
||||
Fahrenheit to Celsius and the result is printed to the console.
|
||||
* A *Message* is sent to a *Channel*, where it is retrieved by a *Chain* which consists of a *Header Enricher* and a *WS Outbound Gateway*.
|
||||
* The *Header Enricher* enriches the *Message* with the SOAP action header.
|
||||
* The *WS Outbound Gateway* converts the *Message* to a SOAP request and sends it to a remote service, which converts a temperature from
|
||||
Fahrenheit (90F) to Celsius (32.2C) and the result is printed to the console:
|
||||
|
||||
````
|
||||
<?xml version="1.0" encoding="UTF-8"?><FahrenheitToCelsiusResponse xmlns="http://tempuri.org/"><FahrenheitToCelsiusResult>32.2222222222222</FahrenheitToCelsiusResult></FahrenheitToCelsiusResponse>````
|
||||
|
||||
## Running the Sample
|
||||
|
||||
To run the sample simply execute **WebServiceDemoTestApp** in package *org.springframework.integration.samples.ws*. You can also execute that class using the [Exec Maven Plugin](http://mojo.codehaus.org/exec-maven-plugin/):
|
||||
|
||||
$ mvn clean package exec:java
|
||||
|
||||
[Simple Object Access Protocol]: http://en.wikipedia.org/wiki/SOAP
|
||||
@@ -5,14 +5,17 @@
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>ws-outbound-gateway</artifactId>
|
||||
<name>Samples (Basic) - WS Outbound Gateway Sample</name>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
<saaj.version>1.3</saaj.version>
|
||||
<saaj.version>1.3.19</saaj.version>
|
||||
<javax-activation.version>1.1.1</javax-activation.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
@@ -53,23 +56,23 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<configuration>
|
||||
<mainClass>org.springframework.integration.samples.ws.WebServiceDemoTestApp</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2</version>
|
||||
<configuration>
|
||||
<mainClass>org.springframework.integration.samples.ws.WebServiceDemoTestApp</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
XML Sample
|
||||
==========
|
||||
|
||||
This example demonstrates the following aspects of the XML support available with Spring Integration:
|
||||
This example demonstrates the following aspects of the [Extensible Markup Language][] (XML) support available with *Spring Integration*:
|
||||
|
||||
1. XPath Splitter - to split an order with multiple items into several order messages for separate processing.
|
||||
2. XPath Router - to route messages according to the evaluation of an XPath expression which tests to see if the order item is in stock.
|
||||
3. XPath Expression - which tests to see if the order item is in stock
|
||||
3. XSLT Transformer - to transform the payload of the order message into a resupply message where the order item is found to be out of stock.
|
||||
1. [XPath][] Splitter - to split an order with multiple items into several order messages for separate processing.
|
||||
2. [XPath][] Router - to route messages according to the evaluation of an [XPath][] expression which tests to see if the order item is in stock.
|
||||
3. [XPath][] Expression - which tests to see if the order item is in stock
|
||||
3. [XSLT][] Transformer - to transform the payload of the order message into a resupply message where the order item is found to be out of stock.
|
||||
|
||||
To run the sample execute class **org.springframework.integration.samples.xml.BookOrderProcessingTestApp**. With Maven you can run the sample by executing:
|
||||
## Running the Sample
|
||||
|
||||
To run the sample, execute the class **org.springframework.integration.samples.xml.BookOrderProcessingTestApp**. Alternatively, you can run the sample using [Maven][] by executing:
|
||||
|
||||
$ mvn clean package exec:java
|
||||
|
||||
@@ -31,4 +33,8 @@ You should see the following output:
|
||||
<bb:isbn>1590596439</bb:isbn>
|
||||
</bb:order>
|
||||
</bb:bigBooksOrder>
|
||||
|
||||
|
||||
[Extensible Markup Language]: http://en.wikipedia.org/wiki/XML
|
||||
[Maven]: http://maven.apache.org/
|
||||
[XPath]: http://en.wikipedia.org/wiki/XPath
|
||||
[XSLT]: http://en.wikipedia.org/wiki/XSLT
|
||||
|
||||
@@ -5,12 +5,15 @@
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>xml</artifactId>
|
||||
<name>Samples (Basic) - XML Sample</name>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
@@ -36,23 +39,23 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<configuration>
|
||||
<mainClass>org.springframework.integration.samples.xml.BookOrderProcessingTestApp</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2</version>
|
||||
<configuration>
|
||||
<mainClass>org.springframework.integration.samples.xml.BookOrderProcessingTestApp</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
XMPP Sample
|
||||
===========
|
||||
|
||||
This example was prepared for testing with GoogleTalk and demonstrates the following aspects of the *Extensible Messaging and Presence Protocol* (XMPP) support available with Spring Integration:
|
||||
This example was prepared for testing with [Google Talk][] and demonstrates the following aspects of the [Extensible Messaging and Presence Protocol][] (XMPP) support available with *Spring Integration*:
|
||||
|
||||
1. XMPP Inbound Channel Adapter - receive instant messages.
|
||||
2. XMPP Outboud Channel Adapter - send instant messages.
|
||||
@@ -16,4 +16,7 @@ Everything there was already preset. The only 3 properties you need to provide v
|
||||
You'll also need to test it with your friend or have two Google accounts setup.
|
||||
|
||||
To test **SendInstantMessageSample.java**, first log on to the account identified via **send.to.user** property and make sure that that account is in your buddy list. Then run the demo.
|
||||
To test **ReceiveInstantMessageSample.java**, first log on to the account identified via **send.to.user** property. Then run the demo. When demo class is started you'll see on GoggleTalk that your buddy (ReceiveInstantMessageSample.java) has just signed on. Now you can send a message from GoogleTalk and see it appear ion the console.
|
||||
To test **ReceiveInstantMessageSample.java**, first log on to the account identified via **send.to.user** property. Then run the demo. Now any instant messages sent to your account appear in the console.
|
||||
|
||||
[Google Talk]: http://www.google.com/talk/
|
||||
[Extensible Messaging and Presence Protocol]: http://en.wikipedia.org/wiki/Extensible_Messaging_and_Presence_Protocol
|
||||
@@ -2,13 +2,18 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>xmpp</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<name>Samples (Basic) - XMPP Demo</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
@@ -34,13 +39,13 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -8,18 +8,18 @@
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-xmpp="http://www.springframework.org/schema/integration/xmpp">
|
||||
|
||||
|
||||
<context:property-placeholder location="classpath:xmpp.properties"/>
|
||||
|
||||
<int-xmpp:xmpp-connection id="googleTalkConnection"
|
||||
user="${user.login}"
|
||||
password="${user.password}"
|
||||
host="${user.host}"
|
||||
service-name="${user.service}"
|
||||
port="${user.port}"/>
|
||||
|
||||
user="${user.login}"
|
||||
password="${user.password}"
|
||||
host="${user.host}"
|
||||
service-name="${user.service}"
|
||||
port="${user.port}"/>
|
||||
|
||||
<int-xmpp:inbound-channel-adapter channel="imOutChannel" xmpp-connection="googleTalkConnection"/>
|
||||
|
||||
<int:logging-channel-adapter id="imOutChannel"/>
|
||||
|
||||
|
||||
</beans>
|
||||
@@ -8,24 +8,24 @@
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-xmpp="http://www.springframework.org/schema/integration/xmpp">
|
||||
|
||||
|
||||
<context:property-placeholder location="classpath:xmpp.properties"/>
|
||||
|
||||
<int-xmpp:xmpp-connection id="googleTalkConnection"
|
||||
user="${user.login}"
|
||||
password="${user.password}"
|
||||
host="${user.host}"
|
||||
service-name="${user.service}"
|
||||
port="${user.port}"/>
|
||||
|
||||
<int:channel id="toUserChannel"/>
|
||||
|
||||
<int-xmpp:header-enricher input-channel="toUserChannel" output-channel="imChannel">
|
||||
<int-xmpp:chat-to value="${send.to.user}"/>
|
||||
</int-xmpp:header-enricher>
|
||||
|
||||
<int:channel id="imChannel"/>
|
||||
|
||||
user="${user.login}"
|
||||
password="${user.password}"
|
||||
host="${user.host}"
|
||||
service-name="${user.service}"
|
||||
port="${user.port}"/>
|
||||
|
||||
<int:channel id="toUserChannel"/>
|
||||
|
||||
<int-xmpp:header-enricher input-channel="toUserChannel" output-channel="imChannel">
|
||||
<int-xmpp:chat-to value="${send.to.user}"/>
|
||||
</int-xmpp:header-enricher>
|
||||
|
||||
<int:channel id="imChannel"/>
|
||||
|
||||
<int-xmpp:outbound-channel-adapter channel="imChannel" xmpp-connection="googleTalkConnection"/>
|
||||
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
<!-- Loggers -->
|
||||
<logger name="org.springframework.integration">
|
||||
<level value="warn" />
|
||||
<level value="info" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.integration.samples">
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<version>1.0.0.BUILD-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>xquery</name>
|
||||
<name>Samples (Basic) - XQuery Sample</name>
|
||||
<url>http://www.springsource.org/spring-integration</url>
|
||||
|
||||
<prerequisites>
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.2.0.RC2</spring.integration.version>
|
||||
<spring.integration.version>2.2.0.RC3</spring.integration.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
|
||||
Reference in New Issue
Block a user