0

I have following flow:

    return flow -> flow.channel(inputChannel())
             ... 
            .gateway(childFlow, addMyInterceptor(str)); // by name
}


Consumer<GatewayEndpointSpec> addMyInterceptor(String objectIdHeader) {
    return endpointSpec -> endpointSpec.advice(addMyInterceptorInternal(objectIdHeader))
            .errorChannel(errorChannel());
}

default IdempotentReceiverInterceptor addMyInterceptorInternal(String header) {
    MessageProcessor<String> headerSelector = message -> headerExpression(header).apply(message);
    var interceptor = new IdempotentReceiverInterceptor(new MetadataStoreSelector(headerSelector, idempotencyStore()));
    interceptor.setDiscardChannel(idempotentDiscardChannel());
    return interceptor;
}

When IdempotentReceiverInterceptor encounters that message is duplicated - I see that application hangs on after 4-th duplicated message. I understand that it is because gateway expected response(like here: PubSubInboundChannelAdapter stops to receive messages after 4th message) but I don't have any ideas how to return result from interceptor.

Could you please explain it for me?

gstackoverflow
  • 36,709
  • 117
  • 359
  • 710

1 Answers1

1

As long as all channels are direct (default) - i.e. no async handoffs in the flow using queue or executor channels, set the gateway's replyTimeout to 0 when the flow might not return a reply

Gary Russell
  • 166,535
  • 14
  • 146
  • 179