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
,IntegrationInboundManagement
,IntegrationManagement
,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
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides
-
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
Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
ConstructorDescriptionJmsMessageDrivenEndpoint
(AbstractMessageListenerContainer listenerContainer, ChannelPublishingJmsMessageListener listener) Construct an instance with an externally configured container. -
Method Summary
Modifier and TypeMethodDescriptionint
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
int
Called before shutdown begins.void
destroy()
protected void
doStart()
Take no action by default.protected void
doStop()
Take no action by default.Subclasses may implement this method to provide component type information.protected void
onInit()
Subclasses may implement this for initialization logic.void
registerMetricsCaptor
(MetricsCaptor captor) Inject aMetricsCaptor
.void
registerObservationRegistry
(io.micrometer.observation.ObservationRegistry observationRegistry) Inject anObservationRegistry
.void
setApplicationContext
(ApplicationContext applicationContext) void
setErrorChannel
(MessageChannel errorChannel) void
setErrorChannelName
(String errorChannelName) Set the error channel name.void
setObservationConvention
(MessageReceiverObservationConvention observationConvention) Set a customMessageReceiverObservationConvention
forIntegrationObservation.HANDLER
.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 tofalse
to prevent listener container shutdown when the endpoint is stopped.Methods inherited from class org.springframework.integration.endpoint.MessageProducerSupport
buildErrorMessage, getErrorChannel, getErrorMessageAttributes, getErrorMessageStrategy, getIntegrationPatternType, getMessagingTemplate, getOutputChannel, isObserved, 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.management.IntegrationManagement
getManagedName, getManagedType, getOverrides, getThisAs, isLoggingEnabled, setLoggingEnabled, setManagedName, setManagedType
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 acknowledgement 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' operation timeout in milliseconds- See Also:
-
setShouldTrack
public void setShouldTrack(boolean shouldTrack) - Specified by:
setShouldTrack
in interfaceTrackableComponent
- Overrides:
setShouldTrack
in classMessageProducerSupport
-
setShutdownContainerOnStop
public void setShutdownContainerOnStop(boolean shutdownContainerOnStop) Set tofalse
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
-
registerMetricsCaptor
Description copied from interface:IntegrationManagement
Inject aMetricsCaptor
. Ignored ifObservationRegistry
is provided.- Specified by:
registerMetricsCaptor
in interfaceIntegrationManagement
- Parameters:
captor
- the captor.- See Also:
-
registerObservationRegistry
public void registerObservationRegistry(io.micrometer.observation.ObservationRegistry observationRegistry) Description copied from interface:IntegrationManagement
Inject anObservationRegistry
. If provided, theMetricsCaptor
is ignored. The meters capturing has to be configured as anObservationHandler
on the providedObservationRegistry
.- Specified by:
registerObservationRegistry
in interfaceIntegrationManagement
- Overrides:
registerObservationRegistry
in classMessageProducerSupport
- Parameters:
observationRegistry
- theObservationRegistry
to expose observations from the component.- See Also:
-
setObservationConvention
Description copied from class:MessageProducerSupport
Set a customMessageReceiverObservationConvention
forIntegrationObservation.HANDLER
. Ignored if anObservationRegistry
is not configured for this component.- Overrides:
setObservationConvention
in classMessageProducerSupport
- Parameters:
observationConvention
- theMessageReceiverObservationConvention
to use.
-
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
- Specified by:
destroy
in interfaceIntegrationManagement
- 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.
-