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, lifecycleLockFields 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 intafterShutdown()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.voidafterSingletonsInstantiated()intbeforeShutdown()Called before shutdown begins.voiddestroy()protected voiddoStart()Take no action by default.protected voiddoStop()Take no action by default.StringgetComponentType()Subclasses may implement this method to provide component type information.ChannelPublishingJmsMessageListenergetListener()protected voidonInit()Subclasses may implement this for initialization logic.voidsetApplicationContext(ApplicationContext applicationContext)voidsetErrorChannel(MessageChannel errorChannel)voidsetErrorChannelName(String errorChannelName)Set the error channel name.voidsetOutputChannel(MessageChannel outputChannel)Specify theMessageChannelto which produced Messages should be sent.voidsetOutputChannelName(String outputChannelName)Set the output channel name; overridesoutputChannelif provided.voidsetSendTimeout(long sendTimeout)Configure the default timeout value to use for send operations.voidsetSessionAcknowledgeMode(String sessionAcknowledgeMode)Set the session acknowledge mode on the listener container.voidsetShouldTrack(boolean shouldTrack)voidsetShutdownContainerOnStop(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, subscribeToPublisherMethods inherited from class org.springframework.integration.endpoint.AbstractEndpoint
doStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stopMethods 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:MessageProducerSpecify theMessageChannelto which produced Messages should be sent.- Specified by:
setOutputChannelin interfaceMessageProducer- Overrides:
setOutputChannelin classMessageProducerSupport- Parameters:
outputChannel- The output channel.
-
setOutputChannelName
Description copied from class:MessageProducerSupportSet the output channel name; overridesoutputChannelif provided.- Specified by:
setOutputChannelNamein interfaceMessageProducer- Overrides:
setOutputChannelNamein classMessageProducerSupport- Parameters:
outputChannelName- the channel name.
-
setErrorChannel
- Overrides:
setErrorChannelin classMessageProducerSupport
-
setErrorChannelName
Description copied from class:MessageProducerSupportSet 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:
setErrorChannelNamein classMessageProducerSupport- Parameters:
errorChannelName- The error channel bean name.
-
setSendTimeout
public void setSendTimeout(long sendTimeout)Description copied from class:MessageProducerSupportConfigure the default timeout value to use for send operations. May be overridden for individual messages.- Overrides:
setSendTimeoutin classMessageProducerSupport- Parameters:
sendTimeout- the send timeout in milliseconds- See Also:
GenericMessagingTemplate.setSendTimeout(long)
-
setShouldTrack
public void setShouldTrack(boolean shouldTrack)- Specified by:
setShouldTrackin interfaceTrackableComponent- Overrides:
setShouldTrackin 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:
setApplicationContextin interfaceApplicationContextAware- Overrides:
setApplicationContextin classIntegrationObjectSupport- Throws:
BeansException
-
getComponentType
Description copied from class:IntegrationObjectSupportSubclasses may implement this method to provide component type information.- Specified by:
getComponentTypein interfaceNamedComponent- Overrides:
getComponentTypein classIntegrationObjectSupport
-
afterSingletonsInstantiated
public void afterSingletonsInstantiated()- Specified by:
afterSingletonsInstantiatedin interfaceSmartInitializingSingleton- Overrides:
afterSingletonsInstantiatedin classMessageProducerSupport
-
onInit
protected void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
onInitin classMessageProducerSupport
-
doStart
protected void doStart()Description copied from class:MessageProducerSupportTake no action by default. Subclasses may override this if they need lifecycle-managed behavior. Protected by 'lifecycleLock'.- Overrides:
doStartin classMessageProducerSupport
-
doStop
protected void doStop()Description copied from class:MessageProducerSupportTake no action by default. Subclasses may override this if they need lifecycle-managed behavior.- Overrides:
doStopin classMessageProducerSupport
-
destroy
public void destroy()- Specified by:
destroyin interfaceDisposableBean- Overrides:
destroyin classAbstractEndpoint
-
beforeShutdown
public int beforeShutdown()Description copied from interface:OrderlyShutdownCapableCalled before shutdown begins. Implementations should stop accepting new messages. Can optionally return the number of active messages in process.- Specified by:
beforeShutdownin interfaceOrderlyShutdownCapable- Returns:
- The number of active messages if available.
-
afterShutdown
public int afterShutdown()Description copied from interface:OrderlyShutdownCapableCalled 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:
afterShutdownin interfaceOrderlyShutdownCapable- Returns:
- The number of active messages if available.
-