Question

I need to send message to 3 services, and aggregate result at the end.
This is easy via publish-subscribe-channel->service-activator(s)->aggregator.

The problem appears when one of the services is in reality 2 calls to other services. At this point I want to introduce additional publish-subscribe-channel and aggregator.

E.g.

publish-subscribe-channel1 -> service-activator group1 -> aggregator1
  \/-> service call -> publish-subscribe-channel2 -> service-activator group2 -> aggregator2 

As a result aggregator2 doesn't group message(send them out one by one).

Aggregator1 gets results from aggregator2 and send out message without waiting for messages from service-activator group 1.

Any suggestions?

Was it helpful?

Solution

All your publish-subscribe-channel should have apply-sequence="true". Of course, if you don't use custom correlation and release strategies.

With apply-sequence="true" the Framework populates standard correlation MessageHeaders and they are stored in the Stack: the nested aggregator gets deal with correlation of its scope and pop them from stack to be ready for the outer aggregation.

And the nested aggregator should send its result to the input channel of outer aggregator. For the last one it will look like just a result of a service.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top