Added support for the 'receive-timeout' on the JMS 'outbound-gateway' element.

This commit is contained in:
Mark Fisher
2008-11-13 00:54:28 +00:00
parent 5673edddcd
commit 37e47f6510
3 changed files with 53 additions and 8 deletions

View File

@@ -69,35 +69,78 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp
private volatile MessageConverter messageConverter = new HeaderMappingMessageConverter(new SimpleMessageConverter());
public void setRequestDestination(Destination requestDestination) {
this.requestDestination = requestDestination;
}
public void setReplyDestination(Destination replyDestination) {
this.replyDestination = replyDestination;
}
/**
* Set the JMS ConnectionFactory that this gateway should use.
* This is a <em>required</em> property.
*/
public void setConnectionFactory(ConnectionFactory connectionFactory) {
this.connectionFactory = connectionFactory;
}
/**
* Set the JMS Destination to which request Messages should be sent.
* This is a <em>required</em> property.
*/
public void setRequestDestination(Destination requestDestination) {
this.requestDestination = requestDestination;
}
/**
* Set the JMS Destination from which reply Messages should be received.
* If none is provided, this gateway will create a {@link TemporaryQueue} per invocation.
*/
public void setReplyDestination(Destination replyDestination) {
this.replyDestination = replyDestination;
}
/**
* Set the max timeout value for the MessageConsumer's receive call when
* waiting for a reply. The default value is 5 seconds.
*/
public void setReceiveTimeout(long receiveTimeout) {
this.receiveTimeout = receiveTimeout;
}
/**
* Specify the JMS DeliveryMode to use when sending request Messages.
*/
public void setDeliveryMode(int deliveryMode) {
this.deliveryMode = deliveryMode;
}
/**
* Specify the JMS priority to use when sending request Messages.
* The value should be within the range of 0-9.
*/
public void setPriority(int priority) {
this.priority = priority;
}
/**
* Specify the timeToLive for each sent Message.
* The default value indicates no expiration.
*/
public void setTimeToLive(long timeToLive) {
this.timeToLive = timeToLive;
}
/**
* Provide a {@link MessageConverter} strategy to use for converting the
* Spring Integration request Message into a JMS Message and for converting
* the JMS reply Messages back into Spring Integration Messages.
* <p>
* The default is a {@link HeaderMappingMessageConverter} that delegates to
* a {@link SimpleMessageConverter}.
*/
public void setMessageConverter(MessageConverter messageConverter) {
Assert.notNull(messageConverter, "'messageConverter' must not be null");
this.messageConverter = messageConverter;
}
/**
* Specify the Spring Integration reply channel. If this property is not
* set the gateway will check for a 'replyChannel' header on the request.
*/
public void setReplyChannel(MessageChannel replyChannel) {
this.setOutputChannel(replyChannel);
}

View File

@@ -44,6 +44,7 @@ public class JmsOutboundGatewayParser extends AbstractConsumerEndpointParser {
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "reply-destination");
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "reply-channel");
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "message-converter");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "receive-timeout");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "delivery-mode");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "time-to-live");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "priority");

View File

@@ -78,6 +78,7 @@
<xsd:attribute name="reply-destination" type="xsd:string"/>
<xsd:attribute name="connection-factory" type="xsd:string" default="connectionFactory"/>
<xsd:attribute name="message-converter" type="xsd:string"/>
<xsd:attribute name="receive-timeout" type="xsd:string"/>
<xsd:attribute name="delivery-mode" type="xsd:string"/>
<xsd:attribute name="time-to-live" type="xsd:string"/>
<xsd:attribute name="priority" type="xsd:string"/>