how to respond from plain tcp client to MessagingTemplate's sendAndReceive

147 views Asked by At

I'm using channel-adapters (not gateways) to send data with MessagingTemplate's sendAndReceive from spring integration server to a connected nonspring client (or just telnet).

After receiving the data in the client, somewhen I want to reply data to the server and resolve that sendAndReceive-Waiting. I still want to be able to send other data to the server.

How will sendAndReceive detect a response? Right now I can send whatever I want to the server, it will assume it as a new incoming message.

Is there a predefined way, like prefixing a messageid or do I have to implement it manually by interpreting the incoming messages and somehow "resolve" the sendAndReceive-blocker?

1

There are 1 answers

0
Artem Bilan On

MessagingTemplate.sendAndReceive is based on the TemporaryReplyChannel which is placed to the MessageHeaders and afterward some AbstractReplyProducingMessageHandler just uses that header to send reply back.

Yes, the sending Thread is blocked to wait for the reply throughout that TemporaryReplyChannel.

Hope that can help you a bit.

All other your comment regarding TCP/IP isn't clear for me yet...