Oct 3rd, 2012, 07:06 AM
Aggergator flow howto
I've some problems with my flow, I hope you could help me with this. The situation I want to achieve is describe in the attached image,
Functional: as input I've an event and which will be transformed in X number of xml-message (I left a few steps out of the image because the are not relevant).
First I collect an object an put it on a subscribable channel, where a service activator and splitter are listening to. (The splitter will aventialy split up the object in het number of messages that will be send out). But this message also need some generic information which is the same for all outgoing messages.
The generic part does some service calls to other systems, this is not something you want to do for every message again. Also don't want to do the generic part in front else I have to store a lot of objects into the payload. And I don't know in how many objects the messages will be splitted.
So I want to aggregate all splitted messages with the "one" generic part, is this possible or should this be solved in a different way?
Oct 3rd, 2012, 08:07 AM
Based on your diagram it seems like you always have to aggregate two messages. Is that correct?
If so all you need is to have apply-sequence="true" set on the pub-sub-channel which is subscribed to by Splitter and ServiceActivator. That will create a correlation id headers, sequence numbers and other things required for aggregation.
Oct 3rd, 2012, 08:20 AM
Thx for the quick response.
Originally Posted by oleg.zhurakousky
The aggregation is over 2 message but it's done multiple times
Say we have input "A" an put this on the pub-sub-channel.
The splitter will take it and split it in A1, A2 and A3.
De service-activator takes it and change the message from A to B
Then the following aggregations have to be done
A1 with B and A2 with B, A3 with B.
Oct 3rd, 2012, 08:29 AM
Sure all is possible. My previous response was based on your diagram and I was trying to emphasize that based on the diagram the aggregation can actually be done using default aggregation strategy. However in your case you may need to implement different correlation and aggregation strategy. The things to keep in mind is when aggregating anything you need to know three things
1. How do entities relate to one another (Correlation)
2. When to release the aggregated entities (Release)
3. How to aggregate (Aggregation) and that is typically means combining all Messages into one (e.g., List of Messages as a payload)
So for you case you probably only have to worry about the first two
I am thinking may be some header enricher to add certain headers to be able to make the Correlation and Release decision
Hoep that helps
Oct 3rd, 2012, 08:37 AM
Sure I can I could enrich the header before putting it on de pub sub channel, so that solve that problem. but does this mean I could read the message B multiple times of a channel?
As result we got (A1 + B), (A2 + B) and (A3 +B), those results will be processed individual so I have to read B multiple times from the channel, and finally marshalled into 3 seperate xml messages. Or do I have to copy (split) B into 3 messages and put it on the same queue so it could be aggregate 3 times?
Oct 3rd, 2012, 08:44 AM
IU am a little confused now but I'd say try both ways and things would become clearer and may be we can discuss it again.
You can also put it into some type of a test case so we can look