Class JmsOutboundGateway
- All Implemented Interfaces:
- MessageListener,- org.reactivestreams.Subscriber<Message<?>>,- Aware,- BeanClassLoaderAware,- BeanFactoryAware,- BeanNameAware,- DisposableBean,- InitializingBean,- ApplicationContextAware,- Lifecycle,- Ordered,- ComponentSourceAware,- ExpressionCapable,- Orderable,- MessageProducer,- HeaderPropagationAware,- IntegrationPattern,- NamedComponent,- IntegrationManagement,- ManageableLifecycle,- TrackableComponent,- MessageHandler,- reactor.core.CoreSubscriber<Message<?>>
- Author:
- Mark Fisher, Arjen Poutsma, Juergen Hoeller, Oleg Zhurakousky, Gary Russell, Artem Bilan, Christian Tzolov
- 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandlerAbstractReplyProducingMessageHandler.RequestHandlerNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagementIntegrationManagement.ManagementOverrides
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final longA default receive timeout in milliseconds.Fields inherited from class org.springframework.integration.handler.AbstractMessageProducingHandlermessagingTemplateFields inherited from class org.springframework.integration.context.IntegrationObjectSupportEXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagementMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.core.OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected ConnectionCreate a new JMS Connection for this JMS gateway.protected SessioncreateSession(Connection connection) Create a new JMS Session using the provided Connection.protected voiddoInit()Subclasses may implement this method to provide component type information.protected ObjecthandleRequestMessage(Message<?> requestMessage) Subclasses must implement this method to handle the request Message.booleanvoidvoidsetConnectionFactory(ConnectionFactory connectionFactory) Set the JMS ConnectionFactory that this gateway should use.voidsetCorrelationKey(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.voidsetDefaultPriority(int priority) Specify the default JMS priority to use when sending request Messages with noIntegrationMessageHeaderAccessor.PRIORITYheader.voidsetDeliveryPersistent(boolean deliveryPersistent) Set whether message delivery should be persistent or non-persistent, specified as a boolean value ("true" or "false").voidsetDestinationResolver(DestinationResolver destinationResolver) Provide theDestinationResolverto use when resolving either a 'requestDestinationName' or 'replyDestinationName' value.voidsetExplicitQosEnabled(boolean explicitQosEnabled) Specify whether explicit QoS settings are enabled (deliveryMode, priority, and timeToLive).voidsetExtractReplyPayload(boolean extractReplyPayload) This property describes what to do with a JMS reply Message.voidsetExtractRequestPayload(boolean extractRequestPayload) This property describes how a JMS Message should be generated from the Spring Integration Message.voidsetHeaderMapper(JmsHeaderMapper headerMapper) Provide aJmsHeaderMapperimplementation for mapping the Spring Integration Message Headers to/from JMS Message properties.voidsetIdleReplyContainerTimeout(long idleReplyContainerTimeout) Set the target timeout for idle containers, in seconds.voidsetIdleReplyContainerTimeout(long idleReplyContainerTimeout, TimeUnit unit) Set the target timeout for idle containers.voidsetMessageConverter(MessageConverter messageConverter) Provide aMessageConverterstrategy 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.voidsetReceiveTimeout(long receiveTimeout) Set the max timeout value for the MessageConsumer's receive call when waiting for a reply.voidsetReplyChannel(MessageChannel replyChannel) Specify the Spring Integration reply channel.voidsetReplyContainerProperties(JmsOutboundGateway.ReplyContainerProperties replyContainerProperties) voidsetReplyDestination(Destination replyDestination) Set the JMS Destination from which reply Messages should be received.voidsetReplyDestinationExpression(Expression replyDestinationExpression) Set the SpEL Expression to be used for determining the reply Destination instance or reply destination name.voidsetReplyDestinationName(String replyDestinationName) Set the name of the JMS Destination from which reply Messages should be received.voidsetReplyPubSubDomain(boolean replyPubSubDomain) Specify whether the reply destination is a Topic.voidsetRequestDestination(Destination requestDestination) Set the JMS Destination to which request Messages should be sent.voidsetRequestDestinationExpression(Expression requestDestinationExpression) Set the SpEL Expression to be used for determining the request Destination instance or request destination name.voidsetRequestDestinationName(String requestDestinationName) Set the name of the JMS Destination to which request Messages should be sent.voidsetRequestPubSubDomain(boolean requestPubSubDomain) Specify whether the request destination is a Topic.voidsetRequiresReply(boolean requiresReply) Flag whether a reply is required.voidsetTimeToLive(long timeToLive) Specify the timeToLive for each sent Message.voidsetUseReplyContainer(boolean useReplyContainer) voidstart()voidstop()Methods inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandlerdoInvokeAdvisedRequestHandler, getBeanClassLoader, getIntegrationPatternType, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoaderMethods inherited from class org.springframework.integration.handler.AbstractMessageProducingHandleraddNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, setupMessageProcessor, shouldCopyRequestHeaders, shouldSplitOutput, updateNotPropagatedHeadersMethods inherited from class org.springframework.integration.handler.AbstractMessageHandlerhandleMessage, onComplete, onError, onNext, onSubscribe, setObservationConventionMethods inherited from class org.springframework.integration.handler.MessageHandlerSupportbuildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getObservationRegistry, getOrder, getOverrides, isLoggingEnabled, isObserved, registerMetricsCaptor, registerObservationRegistry, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrackMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentDescription, getComponentName, getComponentSource, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface reactor.core.CoreSubscribercurrentContextMethods inherited from interface org.springframework.integration.support.management.IntegrationManagementgetThisAsMethods inherited from interface org.springframework.integration.support.context.NamedComponentgetBeanName, getComponentName
- 
Field Details- 
DEFAULT_RECEIVE_TIMEOUTpublic static final long DEFAULT_RECEIVE_TIMEOUTA default receive timeout in milliseconds.- See Also:
 
 
- 
- 
Constructor Details- 
JmsOutboundGatewaypublic JmsOutboundGateway()
 
- 
- 
Method Details- 
setDeliveryPersistentpublic void setDeliveryPersistent(boolean deliveryPersistent) Set whether message delivery should be persistent or non-persistent, specified as a boolean value ("true" or "false"). This will set the delivery mode accordingly to either "PERSISTENT" (1) or "NON_PERSISTENT" (2).The default is "true", i.e. delivery mode "PERSISTENT". - Parameters:
- deliveryPersistent- true for a persistent delivery.
- See Also:
 
- 
setConnectionFactorySet the JMS ConnectionFactory that this gateway should use. This is a required property.- Parameters:
- connectionFactory- The connection factory.
 
- 
setRequestDestinationSet the JMS Destination to which request Messages should be sent. Either this or one of 'requestDestinationName' or 'requestDestinationExpression' is required.- Parameters:
- requestDestination- The request destination.
 
- 
setRequestDestinationNameSet the name of the JMS Destination to which request Messages should be sent. Either this or one of 'requestDestination' or 'requestDestinationExpression' is required.- Parameters:
- requestDestinationName- The request destination name.
 
- 
setRequestDestinationExpressionSet the SpEL Expression to be used for determining the request Destination instance or request destination name. Either this or one of 'requestDestination' or 'requestDestinationName' is required.- Parameters:
- requestDestinationExpression- The request destination expression.
 
- 
setReplyDestinationSet the JMS Destination from which reply Messages should be received. If none is provided, this gateway will create aTemporaryQueueper invocation.- Parameters:
- replyDestination- The reply destination.
 
- 
setReplyDestinationNameSet the name of the JMS Destination from which reply Messages should be received. If none is provided, this gateway will create aTemporaryQueueper invocation.- Parameters:
- replyDestinationName- The reply destination name.
 
- 
setReplyDestinationExpressionSet the SpEL Expression to be used for determining the reply Destination instance or reply destination name. Either this or one of 'replyDestination' or 'replyDestinationName' is required.- Parameters:
- replyDestinationExpression- The reply destination expression.
 
- 
setDestinationResolverProvide theDestinationResolverto use when resolving either a 'requestDestinationName' or 'replyDestinationName' value. The default is an instance ofDynamicDestinationResolver.- Parameters:
- destinationResolver- The destination resolver.
 
- 
setRequestPubSubDomainpublic void setRequestPubSubDomain(boolean requestPubSubDomain) Specify whether the request destination is a Topic. This value is necessary when providing a destination name for a Topic rather than a destination reference.- Parameters:
- requestPubSubDomain- true if the request destination is a Topic.
 
- 
setReplyPubSubDomainpublic void setReplyPubSubDomain(boolean replyPubSubDomain) Specify whether the reply destination is a Topic. This value is necessary when providing a destination name for a Topic rather than a destination reference.- Parameters:
- replyPubSubDomain- true if the reply destination is a Topic.
 
- 
setReceiveTimeoutpublic void setReceiveTimeout(long receiveTimeout) Set the max timeout value for the MessageConsumer's receive call when waiting for a reply. The default value is 5 seconds.- Parameters:
- receiveTimeout- The receive timeout.
 
- 
setDefaultPrioritypublic void setDefaultPriority(int priority) Specify the default JMS priority to use when sending request Messages with noIntegrationMessageHeaderAccessor.PRIORITYheader. The value should be within the range of 0-9.- Parameters:
- priority- The priority.
- Since:
- 5.1.2
 
- 
setTimeToLivepublic void setTimeToLive(long timeToLive) Specify the timeToLive for each sent Message. The default value indicates no expiration.- Parameters:
- timeToLive- The time to live.
 
- 
setExplicitQosEnabledpublic void setExplicitQosEnabled(boolean explicitQosEnabled) Specify whether explicit QoS settings are enabled (deliveryMode, priority, and timeToLive).- Parameters:
- explicitQosEnabled- true to enable explicit QoS.
 
- 
setCorrelationKeyProvide 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. When waiting for the reply Message, a MessageSelector will be configured to match this property name and the UUID value that was sent in the request.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. - Parameters:
- correlationKey- The correlation key.
 
- 
setMessageConverterProvide aMessageConverterstrategy 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.- Parameters:
- messageConverter- The message converter.
 
- 
setHeaderMapperProvide aJmsHeaderMapperimplementation for mapping the Spring Integration Message Headers to/from JMS Message properties.- Parameters:
- headerMapper- The header mapper.
 
- 
setExtractRequestPayloadpublic void setExtractRequestPayload(boolean extractRequestPayload) This property describes how a JMS Message should be generated from the Spring Integration Message. If set to 'true', the body of the JMS Message will be created from the Spring Integration Message's payload (via the MessageConverter). If set to 'false', then the entire Spring Integration Message will serve as the base for JMS Message creation. Since the JMS Message is created by the MessageConverter, this really manages what is sent to theMessageConverter: the entire Spring Integration Message or only its payload. Default is 'true'.- Parameters:
- extractRequestPayload- true to extract the request payload.
 
- 
setExtractReplyPayloadpublic void setExtractReplyPayload(boolean extractReplyPayload) This property describes what to do with a JMS reply Message. If set to 'true', the payload of the Spring Integration Message will be created from the JMS Reply Message's body (via MessageConverter). Otherwise, the entire JMS Message will become the payload of the Spring Integration Message.- Parameters:
- extractReplyPayload- true to extract the reply payload.
 
- 
setReplyChannelSpecify the Spring Integration reply channel. If this property is not set the gateway will check for a 'replyChannel' header on the request.- Parameters:
- replyChannel- The reply channel.
 
- 
setReplyContainerPropertiespublic void setReplyContainerProperties(JmsOutboundGateway.ReplyContainerProperties replyContainerProperties) - Parameters:
- replyContainerProperties- the replyContainerProperties to set
 
- 
getComponentTypeDescription copied from class:IntegrationObjectSupportSubclasses may implement this method to provide component type information.- Specified by:
- getComponentTypein interface- NamedComponent
- Overrides:
- getComponentTypein class- MessageHandlerSupport
 
- 
setUseReplyContainerpublic void setUseReplyContainer(boolean useReplyContainer) - Parameters:
- useReplyContainer- the useReplyContainer to set
 
- 
setRequiresReplypublic void setRequiresReply(boolean requiresReply) Description copied from class:AbstractReplyProducingMessageHandlerFlag whether a reply is required. If true an incoming message MUST result in a reply message being sent. If false an incoming message MAY result in a reply message being sent. Default is false.- Overrides:
- setRequiresReplyin class- AbstractReplyProducingMessageHandler
- Parameters:
- requiresReply- true if a reply is required.
 
- 
setIdleReplyContainerTimeoutpublic void setIdleReplyContainerTimeout(long idleReplyContainerTimeout) Set the target timeout for idle containers, in seconds. Setting this greater than zero enables lazy starting of the reply listener container. The container will be started when a message is sent. It will be stopped when idle for at least this time. The actual stop time may be up to 1.5x this time.- Parameters:
- idleReplyContainerTimeout- the timeout in seconds.
- Since:
- 4.2
 
- 
setIdleReplyContainerTimeoutSet the target timeout for idle containers. Setting this greater than zero enables lazy starting of the reply listener container. The container will be started when a message is sent. It will be stopped when idle for at least this time. The actual stop time may be up to 1.5x this time.- Parameters:
- idleReplyContainerTimeout- the timeout in seconds.
- unit- the time unit.
- Since:
- 4.2
 
- 
doInitprotected void doInit()- Overrides:
- doInitin class- AbstractReplyProducingMessageHandler
 
- 
startpublic void start()- Specified by:
- startin interface- Lifecycle
- Specified by:
- startin interface- ManageableLifecycle
 
- 
stoppublic void stop()- Specified by:
- stopin interface- Lifecycle
- Specified by:
- stopin interface- ManageableLifecycle
 
- 
isRunningpublic boolean isRunning()- Specified by:
- isRunningin interface- Lifecycle
- Specified by:
- isRunningin interface- ManageableLifecycle
 
- 
handleRequestMessageDescription copied from class:AbstractReplyProducingMessageHandlerSubclasses must implement this method to handle the request Message. The return value may be a Message, a MessageBuilder, or any plain Object. The base class will handle the final creation of a reply Message from any of those starting points. If the return value is null, the Message flow will end here.- Specified by:
- handleRequestMessagein class- AbstractReplyProducingMessageHandler
- Parameters:
- requestMessage- The request message.
- Returns:
- The result of handling the message, or null.
 
- 
createConnectionCreate a new JMS Connection for this JMS gateway.- Returns:
- The connection.
- Throws:
- JMSException- Any JMSException.
 
- 
createSessionCreate a new JMS Session using the provided Connection.- Parameters:
- connection- The connection.
- Returns:
- The session.
- Throws:
- JMSException- Any JMSException.
 
- 
onMessage- Specified by:
- onMessagein interface- MessageListener
 
 
-