Files
spring-integration-samples/intermediate/tcp-client-server-multiplex
Gunnar Hillert 85bef285d4 INTSAMPLES-47 - Upgrade SI dep. to 2.1.0.RELEASE
* Upgraded all Spring Integration dependencies to 2.1.0.RELEASE
* All Samples use the new Artifactory-based Milestone Repository http://repo.springsource.org/milestone (As the repositories are additive, this repository will also include the release repo)
* Added versions to all Maven plugin declarations, reducing the amount WARNING-level logging substantially
2012-01-07 22:58:10 -05:00
..

tcp-client-server-multiplex

If this is your first experience with the spring-integrtion-ip module, start with the tcp-client-server project in the basic folder.

That project uses outbound and inbound tcp gateways for communication. As discussed in the Spring Integration Reference Manual, this has some limitations for performance. If a shared socket (single-use="false") is used, only one message can be processed at a time (on the client side); we must wait for the response to the current request before we can send the next request. Otherwise, because only the payload is sent over tcp, the framework cannot correlate responses to requests.

An alternative is to use a new socket for each message, but this comes with a performance overhead.

The solution is to use 'Collaborating Channel Adapters' (see SI Reference Manual). In such a scenario, we can send multiple requests before a response is received. This is termed multiplexing.

This sample demonstrates how to configure collaborating channel adapters, on both the client and server sides, and one technique for correlating the responses to the corresponding request.