springspring-integrationdeclarativereaper

Using a MessageGroupStoreReaper with an Aggregator


The reference documentation recommends using a reaper with an aggregator in order to prevent memory leaks due to stacked-up MessageGroup metadata.

https://docs.spring.io/spring-integration/reference/html/message-routing.html#aggregator

Is this always the case, that a reaper is necessary? Or is there a combination of aggregator attributes like expire-groups-upon-completion and/or expire-groups-upon-timeout that can set up conditions such that MessageGroup data is removed?

thanks for any pointers


Solution

  • Your observation is correct. The expire-groups-upon-completion ensures that completed groups are removed from the store. The expire-groups-upon-timeout, in combination with a group-timeout, does similar to the reaper functionality. Also, if you use a persistent store for the MessageGroupStore, then all your group are unloaded from the memory to DB.