Added support for the 'expect-reply' attribute in JmsGatewayParser. SimpleMessagingGateway now returns void instead of boolean, but it throws a MessageDeliveryException if the underlying RequestReplyTemplate fails to send the Message to the request channel.

This commit is contained in:
Mark Fisher
2008-05-14 14:38:58 +00:00
parent 2b8b4f5a7e
commit 18d03ae2d7
3 changed files with 10 additions and 5 deletions

View File

@@ -21,6 +21,7 @@ import org.springframework.integration.message.DefaultMessageCreator;
import org.springframework.integration.message.DefaultMessageMapper;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessageCreator;
import org.springframework.integration.message.MessageDeliveryException;
import org.springframework.integration.message.MessageMapper;
import org.springframework.util.Assert;
@@ -59,13 +60,14 @@ public class SimpleMessagingGateway extends MessagingGatewaySupport {
this.messageMapper = messageMapper;
}
public boolean send(Object object) {
public void send(Object object) {
Message<?> message = (object instanceof Message) ? (Message) object :
this.messageCreator.createMessage(object);
if (message == null) {
return false;
if (message != null) {
if (!this.getRequestReplyTemplate().send(message)) {
throw new MessageDeliveryException(message, "failed to send Message to channel");
}
}
return this.getRequestReplyTemplate().send(message);
}
public Object receive() {