Reputation: 1
I am connecting to TCP socket using spring integration. I send 2 different messages on an outbound gateway which returns same outputs i.e. header as well as payload.
Now I want to process reply messages differently and then aggregate into a single message which can then be processed by main service class.
I tried various techniques but nothing worked.
Is it feasible to do so? If yes, kindly help me out.
Upvotes: 0
Views: 118
Reputation: 174484
You need something to correlate the messages, maybe a header (e.g. the standard correlation id).
Use a header-enricher to set the correlation id header on each outbound message. Send the reply messages to an <aggregator />
with a simple release strategy (release-strategy-expression="size() == 2"
). When the second reply is received, a message with a payload (collection of the 2 payloads) will be released.
Upvotes: 2