Well, I have added this to the RequestReplyTemplate and it works for me.
Code:
private final ResponseCorrelator correlator;
public RequestReplyTemplate(MessageChannel requestChannel, ResponseCorrelator correlator, ExecutorService executor) {
Assert.notNull(requestChannel, "'requestChannel' must not be null");
Assert.notNull(correlator, "'correlator' must not be null");
Assert.notNull(executor, "'executor' must not be null");
this.requestChannel = requestChannel;
this.correlator = correlator;
this.executor = executor;
}
public RequestReplyTemplate(MessageChannel requestChannel, ResponseCorrelator correlator) {
this(requestChannel, correlator, Executors.newSingleThreadExecutor());
}
public void requestCorrelator(final Message<?> requestMessage) {
ReplyHandler replyHandler = new ReplyHandler() {
public void handle(Message<?> replyMessage, MessageHeader originalMessageHeader) {
correlator.handle(replyMessage);
}
};
request(requestMessage, replyHandler);
}
It misses some checks yet.
However, reading the comments on the Jira it's not this that you want, or at least is only partially what you want?