Pregunta

All spring projects have extensive and extremely helpful documentation and the same is the case for spring integration project but one topic that I want able to gather much information on is message group reapers. Basically it seems like it's a mechanism that can influence an aggregator externally to release some messages. What is unclear is How different or similar it is from a release policy. Does it actually releases messages from aggregator so they are then processed by subsequent components in the flow or it just empties out the aggregator kind of like discarding the aggregated messages. Secondly is there control over which messages are released so messages that belong to a particular group are released but not others.

¿Fue útil?

Solución

Prior to Spring Integration 4.0, the aggregator was a completely passive component. Group release (or not) is triggered by the arrival of a new message - when the release strategy is consulted to see if the group to which the message belongs can be released. So, how do we discard (or release) a group that is idle and has had no new messages arrive for some time?

The reaper runs on a schedule and can detect "stuck" groups and release them based on time without a new message arriving.

It is also used to remove empty groups - the aggregator can be configured so that empty groups remain present so that late arriving messages can be discarded instead of forming a new group. Empty groups can be reaped on a different schedule to partially complete groups.

The reaper expires all groups that meet the configured criteria; if the group passes the criteria, it is expired; otherwise it is not, and will be considered the next time the reaper runs. The action taken by the reaper (partial release, discard etc) depends on other settings on the aggregator.

Spring Integration 4.0 introduced new attributes (group-timeout and group-timeout-expression), allowing partial groups to be released automatically after the timeout, without a reaper (the timer is armed when a new message arrives for a group). The reaper can still be used to expire (remove) empty groups in this case.

I hope that explains the function of the reaper.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top