Class JmsMessageDrivenEndpoint
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.endpoint.MessageProducerSupport
org.springframework.integration.jms.JmsMessageDrivenEndpoint
- All Implemented Interfaces:
Aware
,BeanFactoryAware
,BeanNameAware
,DisposableBean
,InitializingBean
,SmartInitializingSingleton
,ApplicationContextAware
,Lifecycle
,Phased
,SmartLifecycle
,ExpressionCapable
,OrderlyShutdownCapable
,MessageProducer
,IntegrationPattern
,NamedComponent
,ManageableLifecycle
,ManageableSmartLifecycle
,TrackableComponent
public class JmsMessageDrivenEndpoint extends MessageProducerSupport implements OrderlyShutdownCapable
A message-driven endpoint that receive JMS messages, converts them into
Spring Integration Messages, and then sends the result to a channel.
- Author:
- Mark Fisher, Oleg Zhurakousky, Gary Russell, Artem Bilan
-
Field Summary
Fields inherited from class org.springframework.integration.endpoint.AbstractEndpoint
lifecycleCondition, lifecycleLock
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
-
Constructor Summary
Constructors Constructor Description JmsMessageDrivenEndpoint(AbstractMessageListenerContainer listenerContainer, ChannelPublishingJmsMessageListener listener)
Construct an instance with an externally configured container. -
Method Summary
Modifier and Type Method Description int
afterShutdown()
Called after normal shutdown of schedulers, executors etc, and after the shutdown delay has elapsed, but before any forced shutdown of any remaining active scheduler/executor threads.Can optionally return the number of active messages still in process.void
afterSingletonsInstantiated()
int
beforeShutdown()
Called before shutdown begins.void
destroy()
protected void
doStart()
Take no action by default.protected void
doStop()
Take no action by default.String
getComponentType()
Subclasses may implement this method to provide component type information.ChannelPublishingJmsMessageListener
getListener()
protected void
onInit()
Subclasses may implement this for initialization logic.void
setApplicationContext(ApplicationContext applicationContext)
void
setErrorChannel(MessageChannel errorChannel)
void
setErrorChannelName(String errorChannelName)
Set the error channel name.void
setOutputChannel(MessageChannel outputChannel)
Specify theMessageChannel
to which produced Messages should be sent.void
setOutputChannelName(String outputChannelName)
Set the output channel name; overridesoutputChannel
if provided.void
setSendTimeout(long sendTimeout)
Configure the default timeout value to use for send operations.void
setSessionAcknowledgeMode(String sessionAcknowledgeMode)
Set the session acknowledge mode on the listener container.void
setShouldTrack(boolean shouldTrack)
void
setShutdownContainerOnStop(boolean shutdownContainerOnStop)
Set to false to prevent listener container shutdown when the endpoint is stopped.Methods inherited from class org.springframework.integration.endpoint.MessageProducerSupport
buildErrorMessage, getErrorChannel, getErrorMessageAttributes, getIntegrationPatternType, getMessagingTemplate, getOutputChannel, sendErrorMessageIfNecessary, sendMessage, setErrorMessageStrategy, subscribeToPublisher
Methods inherited from class org.springframework.integration.endpoint.AbstractEndpoint
doStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stop
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
JmsMessageDrivenEndpoint
public JmsMessageDrivenEndpoint(AbstractMessageListenerContainer listenerContainer, ChannelPublishingJmsMessageListener listener)Construct an instance with an externally configured container.- Parameters:
listenerContainer
- the container.listener
- the listener.
-
-
Method Details
-
setSessionAcknowledgeMode
Set the session acknowledge mode on the listener container. It will override the container setting even if an external container is provided. Defaults to null (won't change container) if an external container is provided or `transacted` when the framework creates an implicitDefaultMessageListenerContainer
.- Parameters:
sessionAcknowledgeMode
- the acknowledge mode.
-
setOutputChannel
Description copied from interface:MessageProducer
Specify theMessageChannel
to which produced Messages should be sent.- Specified by:
setOutputChannel
in interfaceMessageProducer
- Overrides:
setOutputChannel
in classMessageProducerSupport
- Parameters:
outputChannel
- The output channel.
-
setOutputChannelName
Description copied from class:MessageProducerSupport
Set the output channel name; overridesoutputChannel
if provided.- Specified by:
setOutputChannelName
in interfaceMessageProducer
- Overrides:
setOutputChannelName
in classMessageProducerSupport
- Parameters:
outputChannelName
- the channel name.
-
setErrorChannel
- Overrides:
setErrorChannel
in classMessageProducerSupport
-
setErrorChannelName
Description copied from class:MessageProducerSupport
Set the error channel name. If no error channel is provided, this endpoint will propagate Exceptions to the message-driven source. To completely suppress Exceptions, provide a reference to the "nullChannel" here.- Overrides:
setErrorChannelName
in classMessageProducerSupport
- Parameters:
errorChannelName
- The error channel bean name.
-
setSendTimeout
public void setSendTimeout(long sendTimeout)Description copied from class:MessageProducerSupport
Configure the default timeout value to use for send operations. May be overridden for individual messages.- Overrides:
setSendTimeout
in classMessageProducerSupport
- Parameters:
sendTimeout
- the send timeout in milliseconds- See Also:
GenericMessagingTemplate.setSendTimeout(long)
-
setShouldTrack
public void setShouldTrack(boolean shouldTrack)- Specified by:
setShouldTrack
in interfaceTrackableComponent
- Overrides:
setShouldTrack
in classMessageProducerSupport
-
setShutdownContainerOnStop
public void setShutdownContainerOnStop(boolean shutdownContainerOnStop)Set to false to prevent listener container shutdown when the endpoint is stopped. Then, if so configured, any cached consumer(s) in the container will remain. Otherwise the shared connection and will be closed and the listener invokers shut down; this behavior is new starting with version 5.1. Default: true.- Parameters:
shutdownContainerOnStop
- false to not shutdown.- Since:
- 5.1
-
getListener
-
setApplicationContext
- Specified by:
setApplicationContext
in interfaceApplicationContextAware
- Overrides:
setApplicationContext
in classIntegrationObjectSupport
- Throws:
BeansException
-
getComponentType
Description copied from class:IntegrationObjectSupport
Subclasses may implement this method to provide component type information.- Specified by:
getComponentType
in interfaceNamedComponent
- Overrides:
getComponentType
in classIntegrationObjectSupport
-
afterSingletonsInstantiated
public void afterSingletonsInstantiated()- Specified by:
afterSingletonsInstantiated
in interfaceSmartInitializingSingleton
- Overrides:
afterSingletonsInstantiated
in classMessageProducerSupport
-
onInit
protected void onInit()Description copied from class:IntegrationObjectSupport
Subclasses may implement this for initialization logic.- Overrides:
onInit
in classMessageProducerSupport
-
doStart
protected void doStart()Description copied from class:MessageProducerSupport
Take no action by default. Subclasses may override this if they need lifecycle-managed behavior. Protected by 'lifecycleLock'.- Overrides:
doStart
in classMessageProducerSupport
-
doStop
protected void doStop()Description copied from class:MessageProducerSupport
Take no action by default. Subclasses may override this if they need lifecycle-managed behavior.- Overrides:
doStop
in classMessageProducerSupport
-
destroy
public void destroy()- Specified by:
destroy
in interfaceDisposableBean
- Overrides:
destroy
in classAbstractEndpoint
-
beforeShutdown
public int beforeShutdown()Description copied from interface:OrderlyShutdownCapable
Called before shutdown begins. Implementations should stop accepting new messages. Can optionally return the number of active messages in process.- Specified by:
beforeShutdown
in interfaceOrderlyShutdownCapable
- Returns:
- The number of active messages if available.
-
afterShutdown
public int afterShutdown()Description copied from interface:OrderlyShutdownCapable
Called after normal shutdown of schedulers, executors etc, and after the shutdown delay has elapsed, but before any forced shutdown of any remaining active scheduler/executor threads.Can optionally return the number of active messages still in process.- Specified by:
afterShutdown
in interfaceOrderlyShutdownCapable
- Returns:
- The number of active messages if available.
-