我有以下流程:
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;
}
当IdempotReceiverInterceptor
遇到该消息重复时 - 我发现应用程序在第四条重复消息后挂起。我知道这是因为网关期望响应(如这里: PubSubInboundChannelAdapter stops to receive messages after 4th message ),但我不知道如何从拦截器返回结果。
你能帮我解释一下吗?
最佳答案
只要所有 channel 都是直接的(默认) - 即使用队列或执行器 channel 的流程中没有异步切换,当流程完成时,将网关的 replyTimeout
设置为 0
可能不会返回回复
关于java - 当 IdempotReceiverInterceptor 丢弃消息时流程挂起(在第 4 条消息之后),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59142952/