How to run parallel Aggregators in Spring Integration? -
i'd run spring integration flow can scale instances of components if capacity of reached.
in particular, wonder how scale aggregators in following scenario: various components right before aggregator layer produce different parts of objects of class x - let's produce parts of 2 such objects x1, x2 - parts called {a1, b1} , {a2, b2}, respectively. aggregators should construct x1 , x2 parts , send them on. let's assume there's 2 aggregators, a1 , a2.
how can set works expected, i.e. x1 , x2 created , sent off?
i see following considerations:
- a1 gets a1, a2 gets b1, , x1 can't constructed without here.
- we want load balancing, reason multiple aggregators in first place.
- extra aggregators should added if needed - static configuration of number of aggregators avoided.
i wonder if following work me - based on spring integration docs, i'm not sure if got right.
- set redis message store, parts of x1 , x2 stored before available.
- share message store between aggregator instances. setting (6) in aggregator configuration.
- (as usual aggregator) tag parts (a's , b's) of same x same correlation_id. write releasestrategy based on both , b having been received.
- create redis lock registry , configure aggregators use it. setting (20) in aggregator configuration.
will do? in particular:
- can share messagestore between multiple aggregators?
- when sharing messagestore, if a1 writes a1 , a2 writes b1, releasestrategy see x1 ready assembled?
- will 1 aggregator process aggregation using releasestrategy , send off assembled x, because i'm using locks?
many thanks!
yes work, don't need redis, unless need persistence or aggregators running on different boxes (but see below that); can share same simplemessagestore
between aggregators. default, each aggregator uses own in-memory simplemessagestore
.
and, yes, locks (by correlationid
) ensure 1 aggregator process group @ same time.
... because i'm using locks ...
the aggregator uses own locks internally, don't need lock yourself. in fact, global lockregistry
(gemfire, redis, custom implementation), , persistent message group store (redis etc), aggregators can run on different jvms.
Comments
Post a Comment