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,ComponentSourceAware,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, lifecycleLockFields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsConstructorDescriptionJmsMessageDrivenEndpoint(AbstractMessageListenerContainer listenerContainer, ChannelPublishingJmsMessageListener listener) Construct an instance with an externally configured container. -
Method Summary
Modifier and TypeMethodDescriptionintCalled 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.voidintCalled before shutdown begins.voiddestroy()protected voiddoStart()Take no action by default.protected voiddoStop()Take no action by default.Subclasses may implement this method to provide component type information.protected voidonInit()Subclasses may implement this for initialization logic.voidregisterMetricsCaptor(MetricsCaptor captor) Inject aMetricsCaptor.voidregisterObservationRegistry(io.micrometer.observation.ObservationRegistry observationRegistry) Inject anObservationRegistry.voidsetApplicationContext(ApplicationContext applicationContext) voidsetErrorChannel(MessageChannel errorChannel) voidsetErrorChannelName(String errorChannelName) Set the error channel name.voidsetObservationConvention(MessageReceiverObservationConvention observationConvention) Set a customMessageReceiverObservationConventionforIntegrationObservation.HANDLER.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 tofalseto 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, 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, getComponentDescription, getComponentName, getComponentSource, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, 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.management.IntegrationManagement
getManagedName, getManagedType, getOverrides, getThisAs, isLoggingEnabled, setLoggingEnabled, setManagedName, setManagedTypeMethods 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: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' operation timeout in milliseconds- See Also:
-
setShouldTrack
public void setShouldTrack(boolean shouldTrack) - Specified by:
setShouldTrackin interfaceTrackableComponent- Overrides:
setShouldTrackin classMessageProducerSupport
-
setShutdownContainerOnStop
public void setShutdownContainerOnStop(boolean shutdownContainerOnStop) Set tofalseto 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:IntegrationManagementInject aMetricsCaptor. Ignored ifObservationRegistryis provided.- Specified by:
registerMetricsCaptorin interfaceIntegrationManagement- Parameters:
captor- the captor.- See Also:
-
registerObservationRegistry
public void registerObservationRegistry(io.micrometer.observation.ObservationRegistry observationRegistry) Description copied from interface:IntegrationManagementInject anObservationRegistry. If provided, theMetricsCaptoris ignored. The meters capturing has to be configured as anObservationHandleron the providedObservationRegistry.- Specified by:
registerObservationRegistryin interfaceIntegrationManagement- Overrides:
registerObservationRegistryin classMessageProducerSupport- Parameters:
observationRegistry- theObservationRegistryto expose observations from the component.- See Also:
-
setObservationConvention
Description copied from class:MessageProducerSupportSet a customMessageReceiverObservationConventionforIntegrationObservation.HANDLER. Ignored if anObservationRegistryis not configured for this component.- Overrides:
setObservationConventionin classMessageProducerSupport- Parameters:
observationConvention- theMessageReceiverObservationConventionto use.
-
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- Specified by:
destroyin interfaceIntegrationManagement- 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.
-