public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler implements ManageableLifecycle, MessageListener
Modifier and Type | Class and Description |
---|---|
static class |
JmsOutboundGateway.ReplyContainerProperties |
AbstractReplyProducingMessageHandler.RequestHandler
IntegrationManagement.ManagementOverrides
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_RECEIVE_TIMEOUT
A default receive timeout in milliseconds.
|
messagingTemplate
EXPRESSION_PARSER, logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Constructor and Description |
---|
JmsOutboundGateway() |
Modifier and Type | Method and Description |
---|---|
protected Connection |
createConnection()
Create a new JMS Connection for this JMS gateway.
|
protected Session |
createSession(Connection connection)
Create a new JMS Session using the provided Connection.
|
protected void |
doInit() |
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
protected Object |
handleRequestMessage(Message<?> requestMessage)
Subclasses must implement this method to handle the request Message.
|
boolean |
isRunning() |
void |
onMessage(Message message) |
void |
setConnectionFactory(ConnectionFactory connectionFactory)
Set the JMS ConnectionFactory that this gateway should use.
|
void |
setCorrelationKey(String correlationKey)
Provide the name of a JMS property that should hold a generated UUID that
the receiver of the JMS Message would expect to represent the CorrelationID.
|
void |
setDefaultPriority(int priority)
Specify the default JMS priority to use when sending request Messages with no
IntegrationMessageHeaderAccessor.PRIORITY
header. |
void |
setDeliveryPersistent(boolean deliveryPersistent)
Set whether message delivery should be persistent or non-persistent,
specified as a boolean value ("true" or "false").
|
void |
setDestinationResolver(DestinationResolver destinationResolver)
Provide the
DestinationResolver to use when resolving either a
'requestDestinationName' or 'replyDestinationName' value. |
void |
setExplicitQosEnabled(boolean explicitQosEnabled)
Specify whether explicit QoS settings are enabled
(deliveryMode, priority, and timeToLive).
|
void |
setExtractReplyPayload(boolean extractReplyPayload)
This property describes what to do with a JMS reply Message.
|
void |
setExtractRequestPayload(boolean extractRequestPayload)
This property describes how a JMS Message should be generated from the
Spring Integration Message.
|
void |
setHeaderMapper(JmsHeaderMapper headerMapper)
Provide a
JmsHeaderMapper implementation for mapping the
Spring Integration Message Headers to/from JMS Message properties. |
void |
setIdleReplyContainerTimeout(long idleReplyContainerTimeout)
Set the target timeout for idle containers, in seconds.
|
void |
setIdleReplyContainerTimeout(long idleReplyContainerTimeout,
TimeUnit unit)
Set the target timeout for idle containers.
|
void |
setMessageConverter(MessageConverter messageConverter)
Provide a
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. |
void |
setReceiveTimeout(long receiveTimeout)
Set the max timeout value for the MessageConsumer's receive call when
waiting for a reply.
|
void |
setReplyChannel(MessageChannel replyChannel)
Specify the Spring Integration reply channel.
|
void |
setReplyContainerProperties(JmsOutboundGateway.ReplyContainerProperties replyContainerProperties) |
void |
setReplyDestination(Destination replyDestination)
Set the JMS Destination from which reply Messages should be received.
|
void |
setReplyDestinationExpression(Expression replyDestinationExpression)
Set the SpEL Expression to be used for determining the reply Destination instance
or reply destination name.
|
void |
setReplyDestinationName(String replyDestinationName)
Set the name of the JMS Destination from which reply Messages should be received.
|
void |
setReplyPubSubDomain(boolean replyPubSubDomain)
Specify whether the reply destination is a Topic.
|
void |
setRequestDestination(Destination requestDestination)
Set the JMS Destination to which request Messages should be sent.
|
void |
setRequestDestinationExpression(Expression requestDestinationExpression)
Set the SpEL Expression to be used for determining the request Destination instance
or request destination name.
|
void |
setRequestDestinationName(String requestDestinationName)
Set the name of the JMS Destination to which request Messages should be sent.
|
void |
setRequestPubSubDomain(boolean requestPubSubDomain)
Specify whether the request destination is a Topic.
|
void |
setRequiresReply(boolean requiresReply)
Flag whether a reply is required.
|
void |
setTimeToLive(long timeToLive)
Specify the timeToLive for each sent Message.
|
void |
setUseReplyContainer(boolean useReplyContainer) |
void |
start() |
void |
stop() |
doInvokeAdvisedRequestHandler, getBeanClassLoader, getIntegrationPatternType, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader
addNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, shouldCopyRequestHeaders, shouldSplitOutput, updateNotPropagatedHeaders
handleMessage, onComplete, onError, onNext, onSubscribe
buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getThisAs
getBeanName, getComponentName
public static final long DEFAULT_RECEIVE_TIMEOUT
public void setDeliveryPersistent(boolean deliveryPersistent)
The default is "true", i.e. delivery mode "PERSISTENT".
deliveryPersistent
- true for a persistent delivery.DeliveryMode.PERSISTENT
,
DeliveryMode.NON_PERSISTENT
public void setConnectionFactory(ConnectionFactory connectionFactory)
connectionFactory
- The connection factory.public void setRequestDestination(Destination requestDestination)
requestDestination
- The request destination.public void setRequestDestinationName(String requestDestinationName)
requestDestinationName
- The request destination name.public void setRequestDestinationExpression(Expression requestDestinationExpression)
requestDestinationExpression
- The request destination expression.public void setReplyDestination(Destination replyDestination)
TemporaryQueue
per invocation.replyDestination
- The reply destination.public void setReplyDestinationName(String replyDestinationName)
TemporaryQueue
per invocation.replyDestinationName
- The reply destination name.public void setReplyDestinationExpression(Expression replyDestinationExpression)
replyDestinationExpression
- The reply destination expression.public void setDestinationResolver(DestinationResolver destinationResolver)
DestinationResolver
to use when resolving either a
'requestDestinationName' or 'replyDestinationName' value. The default
is an instance of DynamicDestinationResolver
.destinationResolver
- The destination resolver.public void setRequestPubSubDomain(boolean requestPubSubDomain)
requestPubSubDomain
- true if the request destination is a Topic.public void setReplyPubSubDomain(boolean replyPubSubDomain)
replyPubSubDomain
- true if the reply destination is a Topic.public void setReceiveTimeout(long receiveTimeout)
receiveTimeout
- The receive timeout.public void setDefaultPriority(int priority)
IntegrationMessageHeaderAccessor.PRIORITY
header. The value should be within the range of 0-9.priority
- The priority.public void setTimeToLive(long timeToLive)
timeToLive
- The time to live.public void setExplicitQosEnabled(boolean explicitQosEnabled)
explicitQosEnabled
- true to enable explicit QoS.public void setCorrelationKey(String correlationKey)
If this value is NULL (the default) then the reply consumer's MessageSelector will be expecting the JMSCorrelationID to equal the Message ID of the request.
If you want to store the outbound correlation UUID value in the actual JMSCorrelationID property, then set this value to "JMSCorrelationID".
If you want to use and existing "JMSCorrelationID" from the inbound message (mapped from 'jms_correlationId'), you can set this property to "JMSCorrelationID*" with the trailing asterisk. If the message has a correlation id, it will be used, otherwise a new one will be set in the 'JMSCorrelationID' header. However, understand that the gateway has no means to ensure uniqueness and unexpected side effects can occur if the correlation id is not unique.
This setting is not allowed if a reply listener is used.
correlationKey
- The correlation key.public void setMessageConverter(MessageConverter messageConverter)
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.
The default is SimpleMessageConverter
.
messageConverter
- The message converter.public void setHeaderMapper(JmsHeaderMapper headerMapper)
JmsHeaderMapper
implementation for mapping the
Spring Integration Message Headers to/from JMS Message properties.headerMapper
- The header mapper.public void setExtractRequestPayload(boolean extractRequestPayload)
MessageConverter
:
the entire Spring Integration Message or only its payload.
Default is 'true'.extractRequestPayload
- true to extract the request payload.public void setExtractReplyPayload(boolean extractReplyPayload)
extractReplyPayload
- true to extract the reply payload.public void setReplyChannel(MessageChannel replyChannel)
replyChannel
- The reply channel.public void setReplyContainerProperties(JmsOutboundGateway.ReplyContainerProperties replyContainerProperties)
replyContainerProperties
- the replyContainerProperties to setpublic String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class MessageHandlerSupport
public void setUseReplyContainer(boolean useReplyContainer)
useReplyContainer
- the useReplyContainer to setpublic void setRequiresReply(boolean requiresReply)
AbstractReplyProducingMessageHandler
setRequiresReply
in class AbstractReplyProducingMessageHandler
requiresReply
- true if a reply is required.public void setIdleReplyContainerTimeout(long idleReplyContainerTimeout)
idleReplyContainerTimeout
- the timeout in seconds.public void setIdleReplyContainerTimeout(long idleReplyContainerTimeout, TimeUnit unit)
idleReplyContainerTimeout
- the timeout in seconds.unit
- the time unit.protected void doInit()
doInit
in class AbstractReplyProducingMessageHandler
public void start()
start
in interface Lifecycle
start
in interface ManageableLifecycle
public void stop()
stop
in interface Lifecycle
stop
in interface ManageableLifecycle
public boolean isRunning()
isRunning
in interface Lifecycle
isRunning
in interface ManageableLifecycle
protected Object handleRequestMessage(Message<?> requestMessage)
AbstractReplyProducingMessageHandler
handleRequestMessage
in class AbstractReplyProducingMessageHandler
requestMessage
- The request message.null
.protected Connection createConnection() throws JMSException
JMSException
- Any JMSException.protected Session createSession(Connection connection) throws JMSException
connection
- The connection.JMSException
- Any JMSException.public void onMessage(Message message)
onMessage
in interface MessageListener