3
votes

I am new to spring-integration and want to understand how to implement the following scenario using Spring Integration.

I am trying to create a distributed application which will have multiple nodes(like in a cluster) with following requirements.

-I need to implement the request/reply based messaging over TCP/IP.
-I do not want to use a message broker (e.g. ActiveMQ).
-I am planning to use the TCP inbound and outbound gateways provided by SI.

I am not sure how SI can help me achieve the following
- How will the request/reply correlation work when there are multiple clients connecting to the same server side TCP-inbound-gateway?
- I understand that the message headers get stripped off when sending the message over TCP/IP, what is the workaround?
- Is this approach workable at all? :(

Thank you
Sandip

1

1 Answers

6
votes

If you use gateways, the framework will take care of the correlation for you.

There is a sample that shows this here...

https://github.com/SpringSource/spring-integration-samples

(see basic/tcp-client-server).

There is discussion about message correlation in the reference manual...

http://static.springsource.org/spring-integration/docs/2.1.0.RELEASE/reference/html/ip.html#ip-correlation

If you need to use adapters instead of gateways (because you need asynch messaging or can't live with some of the performance limitations of gateways), then you need to add correlation data to the message payload.

We have an open JIRA issue

https://jira.springsource.org/browse/INT-1807

to allow transporting some of the headers over TCP. However, since there is no natural standard way to do this, it would likely only be usable for SI to SI communication (or would need custom code on the peer). We will likely have that in a 2.2. milestone soon. Vote it up!

Hope that helps.

UPDATE: The 3.0 release supports adding selected headers to the TCP message.