1

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!

  • Show us, please, the configuration for that `channel3`! We don't know what's going on on your subscribers. – Artem Bilan Sep 12 '15 at 21:13
  • Added the consumers for the channel3. When I debug, I see that the message does come to postAggregation channel and then also into the aggregatorOutputChannel. And it steps though the sysouts. – Subir Parulekar Sep 13 '15 at 07:17
  • Please, pay attention to the JIRA on the matter https://jira.spring.io/browse/INTEXT-192. Maybe this is your issue and you have not just read the logs properly... – Artem Bilan Sep 13 '15 at 14:33
  • Hi Artem. Thanks for filing the JIRA and creating a PR. I checked the logs and there is no exception being printed. When will this fix be available in the dsl libraries? – Subir Parulekar Sep 13 '15 at 16:16
  • The fix must be available just after my talk on SpringOne (https://2015.event.springone2gx.com/schedule/sessions/spring_integration_java_dsl.html). Meanwhile can you share with us an experience how does it work if you bypass that explicit `aggregatorOutputChannel`. BTW trying to reproduce something with that your valuable config. Stay in touch! – Artem Bilan Sep 13 '15 at 16:22
  • Nope. I can't reproduce it. Please, share with us the DEBUG logs for the `org.springframework.integration` category to see how your messages travel through the channels. – Artem Bilan Sep 13 '15 at 16:50
  • Wish I could attend the talk. Should be interesting. Is there a candidate/snapshot version that I could pull in to test it out here? I am currently on spring-integration-java-dsl:1.0.1.RELEASE. I am not sure I understand how I can bypass the aggregatorOutputChannel. That is a channel that I want my gateway to block on and return when a message gets put into that channel. If I bypass it, how will the gateway unblock? – Subir Parulekar Sep 13 '15 at 16:51
  • The `gateway` works even without explicit `replyChannel`. There is just enough rely on the `TemporaryReplyChannel` header, which is there anyway, even if you specify `replyChannel` manually. Any `reply-aware` component (like `.aggregate()` in your case) can deal just only with that `replyChannel` header. That is how it works even without this my fix. Please, read here (http://docs.spring.io/spring-integration/docs/latest-ga/reference/html/messaging-endpoints-chapter.html#gateway-default-reply-channel) more about `replyChannel` – Artem Bilan Sep 13 '15 at 16:59
  • Hello! You can find the latest release already: http://repo.spring.io/release/org/springframework/integration/spring-integration-java-dsl/1.1.0.RELEASE/ – Artem Bilan Sep 21 '15 at 19:26

0 Answers0