I have the following configs
@Bean
public IntegrationFlow mainFlow(){
return IntegrationFlows.from("channel1")
.route("condition", p -> p
.subFlowMapping("true", flow -> flow.gateway("channel2"))
.subFlowMapping("false" flow -> {
flow.gateway("channel3", c -> c.replyChannel("aggregatorOutputChannel"));
flow.gateway("channel4");
})
.get();
}
@Bean
public MessageChannel channel3()
{
return MessageChannels.publishSubscribe().applySequence(true).get();
}
@Bean
public IntegrationFlow flow1(){
return IntegrationFlows.from("channel3")
.transform(s -> {
System.out.println(s);
return s;
}
.channel("aggregatorInputChannel")
.get();
}
@Bean
public IntegrationFlow flow2(){
return IntegrationFlows.from("channel3")
.split()
.transform(s -> {
System.out.println(s);
return s;
}
.aggregate()
.channel("aggregatorInputChannel")
.get();
}
@Bean
public IntegrationFlow aggregatorFlow(){
return IntegrationFlows.from("aggregatorInputChannel")
.aggregate((AggregatorSpec s) -> s.groupTimeout(60000)
.outputProcessor(new AggregationMessageGroupProcessor())
.sendPartialResultOnExpiry(true)
.expireGroupsUponCompletion(true)
.releaseStrategy(new TimeoutOrSequenceCountComparatorReleaseStrategy(4, 60000)), null)
.gateway("postAggregation")
.channel("aggregatorOutputChannel")
.get();
}
Channel 3 is a pub-sub channel and there are 2 consumers that process the message and put a message in the aggregatorInputChannel after they are done. However what I am observing is that even though the message is finally put in the aggregatorOutputChannel (I debugged though the aggregator bean definition and I can see the message going into the aggregatorOutputChannel), the gateway on channel3 blocks and never returns. As a result the message never goes to channel4.
Am I missing something here? Or doing something wrong?
AggregationMessageGroupProcessor is my custom aggregator in which all I do is override the aggregatePayloads method
public class AggregationMessageGroupProcessor extends AbstractAggregatingMessageGroupProcessor {
@Override
protected final Object aggregatePayloads(MessageGroup group, Map<String, Object> headers) {
group.getOne().getPayload();
}
}
Thanks!