I am looking to combine the responses from two webservice calls. the aggregation would happened based on a key value in the responses.
ws1,ws2(responses from ws1 and ws2 are passed to aggregator)--->aggregator--->response. I return the following code. The aggregator is not being invoked, not sure what I am missing.
<int-ws:outbound-gateway id="marshallingGateway1" request-channel="RequestChannel1" reply-channel="replyChannel"
uri="https://abc:8080/" message-sender="messageSender"
marshaller="marshaller" unmarshaller="marshaller">
<int-ws:request-handler-advice-chain>
<ref bean="retryAdvice"/>
</int-ws:request-handler-advice-chain>
</int-ws:outbound-gateway>
<int-ws:outbound-gateway id="marshallingGateway2" request-channel="RequestChannel2" reply-channel="replyChannel"
uri="https://abc:8080/" message-sender="messageSender"
marshaller="marshaller" unmarshaller="marshaller">
<int-ws:request-handler-advice-chain>
<ref bean="retryAdvice"/>
</int-ws:request-handler-advice-chain>
</int-ws:outbound-gateway>
<int:aggregator id="responseAggregator" input-channel="replyChannel" ref="responseAggregator" message-store="messageStore" send-partial-result-on-expiry="true"/>
<bean id="messageStore" class="org.springframework.integration.store.SimpleMessageStore"/>
<bean id="responseAggregator" class="abc.cbd.ResponseAggregator"/>
You don't seem to be setting up any correlation between the two results.
By default, a header correlationId
is used by the default correlation strategy.
You also need a ReleaseStrategy
. It can be as simple as release-strategy-expression="size == 2"
.
The default release strategy uses sequenceSize
and sequenceNumber
headers.
If you are using a publish-subscribe channel to send the same message to the two gateways, set the apply-sequence
property to true
and then you don't need a custom release or correlation strategy.