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?
Asked
Active
Viewed 303 times
2 Answers
1
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())

Artem Bilan
- 113,505
- 11
- 91
- 118
-
But now if I add .sendPartialResultsOnExpiry(true) to the above chain, the code is not compiling :( And what does null at the end means? – Nikhil Sep 17 '14 at 11:54
-
Sorry i got it. I have to use .sendPartialResultOnExpiry(true) – Nikhil Sep 17 '14 at 11:58
-
Added explanation to the answer – Artem Bilan Sep 17 '14 at 12:17
1
Thanks Artem.I am able to solve the problem with the following configuration.
@Bean
public IntegrationFlow pollingFlow() {
return IntegrationFlows.from(splitSegment())
.aggregate( a -> a
.expireGroupsUponCompletion(true)
.messageStore(persistenceMessageStore())
.sendPartialResultOnExpiry(true)
.discardChannel(aggregateSegments())
.correlationStrategy(m -> m.getPayload())
.releaseStrategy(g -> g.getMessages().size() > 5)
.outputProcessor(g -> {
CountDB ag = new CountDB();
ag.setId((Long) g.getOne().getPayload());
ag.setActiveUsers((long)g.getMessages().size());
return ag;
})
,
null)
.channel(aggregateSegments())
.get();

Nikhil
- 83
- 6