Cisco Java
Cisco Java

Reputation: 233

Manually releasing Aggregator messages

I have a simple use case where I have used Aggregator with MessageCountReleaseStrategy. At the close of business there are some messages that are stored in message store overnight. Next day after arrival of remaining messages the group gets released.

Now I want to add capability to peek into the messages stored(not released) at end of day and provide an option to release the messages if the user wants to.

Need pointers on how to peek into the messages stored. For simplicity of this use case I am considering only 1 Message Group.

<int:aggregator input-channel="orderItem"              output-channel="orders"
                ref="orderAggregator"                  method="createOrders"
                expire-groups-upon-completion="true"   release-strategy="messageCountReleaseStrategy" 
                message-store="messageStore"           discard-channel="aggregatorDiscard" />

<bean id="messageCountReleaseStrategy" class="org.springframework.integration.aggregator.MessageCountReleaseStrategy">
    <constructor-arg index="0" value="10"/>
</bean> 

Upvotes: 1

Views: 334

Answers (1)

Gary Russell
Gary Russell

Reputation: 174574

You can call MessageGroupStore.getGroupMetadata(key) where key is the correlationKey.

You can call MessageGroupStore.expireMessageGroups(0) to expire all partial groups.

If send-partial-result-on-expiry is true, the partial group will go to the normal output channel, if false, to the discard channel.

Upvotes: 1

Related Questions