Cron expression as an aggregator release strategy

I would like to add aggregator

to my chain that aggregates all incoming messages (String) and outputs the aggregated message (String) at certain points that I would like to define using the expression "cron", (for example, those used in experiments)

Any idea on how to do this?

Thank!

+3


source to share


1 answer


Since you only want to release your posts from the aggregator using a cron expression, I recommend that you take a look at MessageGroupStoreReaper

which is responsible for starting the operation forceComplete

on the aggregator. As you can see from the documentation, the material cron

should be done on <task:scheduled>

.

messageStore

for MessageGroupStoreReaper

must be that of <aggregator>

and not shared with other components.

Aggregator configuration might look like this:



<aggregator message-store="messageStore"
   release-strategy-expression="false"
   expire-groups-upon-completion="true"
   send-partial-result-on-expiry="true"/>

      

This is recommended for implementation ReleaseStrategy

in this case, since the release strategy is only available when a new message arrives, which makes the time-free strategy impossible.

+3


source







All Articles