Search code examples
springspring-integrationspring-annotations

Spring Aggregator Annotation doesnot have expireGroupUponCompletion and persistenceStore as input


I recently moved to Spring boot and started converting all the XMLs to Java Configs. The @Aggregate annotation does not have expireGroupUponCompletion and persistenceStore as the input. Is there any other way we can specify these things?


Solution

  • Is there any other way we can specify these things?

    Using Spring Integration Java DSL:

    .aggregate(a -> a.expireGroupsUponCompletion(true)
                     .sendPartialResultOnExpiry(true)
                     .messageStore(messageStore(), null)
    

    The second null param means that we aren't interested in some endpoint customization and just rely on the defaul state. We left that syntax to avoid the explicit type for Lambda argument:

    .aggregate((AggregatorSpec a) -> a.expireGroupsUponCompletion(true)
                     .sendPartialResultOnExpiry(true)
                     .messageStore(messageStore())