INT-1411 added receive and receiveAndConvert methods to AsyncMessagingTemplate and AsyncMessagingOperations
This commit is contained in:
@@ -27,6 +27,18 @@ import org.springframework.integration.MessageChannel;
|
||||
*/
|
||||
public interface AsyncMessagingOperations {
|
||||
|
||||
<P> Future<Message<P>> asyncReceive();
|
||||
|
||||
<P> Future<Message<P>> asyncReceive(PollableChannel channel);
|
||||
|
||||
<P> Future<Message<P>> asyncReceive(String channelName);
|
||||
|
||||
<R> Future<R> asyncReceiveAndConvert();
|
||||
|
||||
<R> Future<R> asyncReceiveAndConvert(PollableChannel channel);
|
||||
|
||||
<R> Future<R> asyncReceiveAndConvert(String channelName);
|
||||
|
||||
Future<Message<?>> asyncSendAndReceive(Message<?> requestMessage);
|
||||
|
||||
Future<Message<?>> asyncSendAndReceive(MessageChannel channel, Message<?> requestMessage);
|
||||
|
||||
@@ -93,4 +93,55 @@ public class AsyncMessagingTemplate extends MessagingTemplate implements AsyncMe
|
||||
});
|
||||
}
|
||||
|
||||
public <P> Future<Message<P>> asyncReceive() {
|
||||
return this.executor.submit(new Callable<Message<P>>() {
|
||||
public Message<P> call() throws Exception {
|
||||
return receive();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public <P> Future<Message<P>> asyncReceive(final PollableChannel channel) {
|
||||
return this.executor.submit(new Callable<Message<P>>() {
|
||||
public Message<P> call() throws Exception {
|
||||
return receive(channel);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public <P> Future<Message<P>> asyncReceive(final String channelName) {
|
||||
return this.executor.submit(new Callable<Message<P>>() {
|
||||
public Message<P> call() throws Exception {
|
||||
return receive(channelName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <R> Future<R> asyncReceiveAndConvert() {
|
||||
return this.executor.submit(new Callable<R>() {
|
||||
public R call() throws Exception {
|
||||
return (R) receiveAndConvert();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <R> Future<R> asyncReceiveAndConvert(final PollableChannel channel) {
|
||||
return this.executor.submit(new Callable<R>() {
|
||||
public R call() throws Exception {
|
||||
return (R) receiveAndConvert(channel);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <R> Future<R> asyncReceiveAndConvert(final String channelName) {
|
||||
return this.executor.submit(new Callable<R>() {
|
||||
public R call() throws Exception {
|
||||
return (R) receiveAndConvert(channelName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user