I'd like to run a Spring Integration flow where I can easily scale up instances of components if capacity of any is reached.
In particular, I wonder how to scale Aggregators in a following scenario: Various components right before the Aggregator layer produce different parts of objects of class X - let's say they produce parts of two such objects X1, X2 - parts are called {a1, b1} and {a2, b2}, respectively. The Aggregators should now construct X1 and X2 from their parts and send them on. Let's also assume there's two Aggregators, A1 and A2.
How can I set it up most easily so that it works as expected, i.e. X1 and X2 are created and sent off?
I see the following considerations:
I wonder if the following will work for me - this is based on Spring Integration docs, but I'm not sure if I got it all right.
Will this do? In particular:
Many thanks!
Yes it will work, but you don't need Redis, unless you need persistence or your aggregators are running on different boxes (but see below for that); you can share the same SimpleMessageStore
between the aggregators. By default, each aggregator uses its own in-memory SimpleMessageStore
.
And, yes, locks (by correlationId
) ensure only one aggregator will process a group at the same time.
... because I'm using locks ...
The aggregator uses its own locks internally, you don't need to lock anything yourself. In fact, with a global LockRegistry
(gemfire, redis, custom implementation), and a persistent message group store (redis etc), your aggregators can run on different JVMs.