From bbc14e5bbe0fab2a39e6ccd42adf97d150984a4c Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Fri, 19 Sep 2008 13:19:13 +0000 Subject: [PATCH] SimpleMessagingGateway now supports a subscribable channel for its 'replyChannel'. However, when attempting to use the gateway for simple 'receive' operations, an exception will be thrown if the replyChannel is not a PollableChannel. The subscribable channel is only a relevant option when relying upon reply-message correlation. --- .../integration/gateway/SimpleMessagingGateway.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/gateway/SimpleMessagingGateway.java b/org.springframework.integration/src/main/java/org/springframework/integration/gateway/SimpleMessagingGateway.java index a712435879..8d54c02d9d 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/gateway/SimpleMessagingGateway.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/gateway/SimpleMessagingGateway.java @@ -44,7 +44,7 @@ public class SimpleMessagingGateway extends MessagingGatewaySupport implements M private volatile MessageChannel requestChannel; - private volatile PollableChannel replyChannel; + private volatile MessageChannel replyChannel; private volatile MessageCreator messageCreator = new DefaultMessageCreator(); @@ -114,11 +114,11 @@ public class SimpleMessagingGateway extends MessagingGatewaySupport implements M } public Object receive() { - if (this.replyChannel == null) { + if (this.replyChannel == null || !(this.replyChannel instanceof PollableChannel)) { throw new IllegalStateException( - "no-arg receive is not supported, because no reply channel has been configured"); + "no-arg receive is not supported, because no pollable reply channel has been configured"); } - Message message = this.getChannelTemplate().receive(this.replyChannel); + Message message = this.getChannelTemplate().receive((PollableChannel) this.replyChannel); return (message != null) ? this.messageMapper.mapMessage(message) : null; }