Even though the MessageChannelTemplate is fairly straightforward, it does not hide the
details of messaging from your application code. To support working with plain Objects instead of messages,
Spring Integration provides SimpleMessagingGateway with the following methods:
public void send(Object object) { ... } public Object receive() { ... } public Object sendAndReceive(Object object) { ... } Message<?> sendAndReceiveMessage(Object object);
It enables configuration of a request and/or reply channel and delegates to instances of the
InboundMessageMapper and OutboundMessageMapper
strategy interfaces.
SimpleMessagingGateway gateway = new SimpleMessagingGateway(inboundMapper, outboundMapper); gateway.setRequestChannel(requestChannel); gateway.setReplyChannel(replyChannel); Object result = gateway.sendAndReceive("test");