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:
Gunnar Hillert
2012-10-28 22:51:14 -04:00
parent 251e035a18
commit 3c9c91c847
93 changed files with 1666 additions and 1454 deletions

View File

@@ -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

View File

@@ -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>