Class JmsInboundGateway
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.gateway.MessagingGatewaySupport
org.springframework.integration.jms.JmsInboundGateway
- All Implemented Interfaces:
Aware
,BeanFactoryAware
,BeanNameAware
,DisposableBean
,InitializingBean
,ApplicationContextAware
,Lifecycle
,Phased
,SmartLifecycle
,ExpressionCapable
,OrderlyShutdownCapable
,IntegrationPattern
,NamedComponent
,IntegrationInboundManagement
,IntegrationManagement
,ManageableLifecycle
,ManageableSmartLifecycle
,TrackableComponent
A wrapper around the
JmsMessageDrivenEndpoint
implementing
MessagingGatewaySupport
.- Since:
- 5.0
- Author:
- Artem Bilan, Gary Russell
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.integration.gateway.MessagingGatewaySupport
MessagingGatewaySupport.ConvertingMessagingTemplate
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides
-
Field Summary
Fields inherited from class org.springframework.integration.gateway.MessagingGatewaySupport
messagingTemplate
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
ConstructorDescriptionJmsInboundGateway
(AbstractMessageListenerContainer listenerContainer, ChannelPublishingJmsMessageListener listener) -
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.int
Called before shutdown begins.void
destroy()
protected void
doStart()
Subclasses must implement this method with the start behavior.protected void
doStop()
Subclasses must implement this method with the stop behavior.Subclasses may implement this method to provide component type information.protected void
onInit()
Subclasses may implement this for initialization logic.void
registerMetricsCaptor
(MetricsCaptor metricsCaptorToRegister) Inject aMetricsCaptor
.void
registerObservationRegistry
(io.micrometer.observation.ObservationRegistry observationRegistry) Inject anObservationRegistry
.void
setApplicationContext
(ApplicationContext applicationContext) void
setErrorChannel
(MessageChannel errorChannel) Set the error channel.void
setErrorChannelName
(String errorChannelName) Set the error channel name.void
setErrorOnTimeout
(boolean errorOnTimeout) If errorOnTimeout is true, construct an instance that will send anErrorMessage
with aMessageTimeoutException
payload to the error channel if a reply is expected but none is received.void
setObservationConvention
(MessageRequestReplyReceiverObservationConvention observationConvention) void
setReplyChannel
(MessageChannel replyChannel) Set the reply channel.void
setReplyChannelName
(String replyChannelName) Set the reply channel name.void
setReplyTimeout
(long replyTimeout) Set the timeout value for receiving reply messages.void
setRequestChannel
(MessageChannel requestChannel) Set the request channel.void
setRequestChannelName
(String requestChannelName) Set the request channel name.void
setRequestTimeout
(long requestTimeout) Set the timeout value for sending request messages.void
setShouldTrack
(boolean shouldTrack) Specify whether this gateway should be tracked in the Message History of Messages that originate from its send or sendAndReceive operations.void
setShutdownContainerOnStop
(boolean shutdownContainerOnStop) Set to false to prevent listener container shutdown when the endpoint is stopped.Methods inherited from class org.springframework.integration.gateway.MessagingGatewaySupport
buildErrorMessage, buildSendTimer, getErrorChannel, getErrorMessageAttributes, getErrorMessageStrategy, getIntegrationPatternType, getManagedName, getManagedType, getOverrides, getReplyChannel, getRequestChannel, isLoggingEnabled, isObserved, receive, receive, receiveMessage, receiveMessage, registerReplyMessageCorrelatorIfNecessary, send, sendAndReceive, sendAndReceiveMessage, sendAndReceiveMessageReactive, sendTimer, setErrorMessageStrategy, setLoggingEnabled, setManagedName, setManagedType, setReceiverObservationConvention, setReplyMapper, setRequestMapper
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
getThisAs
Methods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
JmsInboundGateway
public JmsInboundGateway(AbstractMessageListenerContainer listenerContainer, ChannelPublishingJmsMessageListener listener)
-
-
Method Details
-
setRequestChannel
Description copied from class:MessagingGatewaySupport
Set the request channel.- Overrides:
setRequestChannel
in classMessagingGatewaySupport
- Parameters:
requestChannel
- the channel to which request messages will be sent
-
setRequestChannelName
Description copied from class:MessagingGatewaySupport
Set the request channel name.- Overrides:
setRequestChannelName
in classMessagingGatewaySupport
- Parameters:
requestChannelName
- the channel bean name to which request messages will be sent
-
setReplyChannel
Description copied from class:MessagingGatewaySupport
Set the reply channel. If no reply channel is provided, this gateway will always use an anonymous, temporary channel for handling replies.- Overrides:
setReplyChannel
in classMessagingGatewaySupport
- Parameters:
replyChannel
- the channel from which reply messages will be received
-
setReplyChannelName
Description copied from class:MessagingGatewaySupport
Set the reply channel name. If no reply channel is provided, this gateway will always use an anonymous, temporary channel for handling replies.- Overrides:
setReplyChannelName
in classMessagingGatewaySupport
- Parameters:
replyChannelName
- the channel bean name from which reply messages will be received
-
setErrorChannel
Description copied from class:MessagingGatewaySupport
Set the error channel. If no error channel is provided, this gateway will propagate Exceptions to the caller. To completely suppress Exceptions, provide a reference to the "nullChannel" here.- Overrides:
setErrorChannel
in classMessagingGatewaySupport
- Parameters:
errorChannel
- The error channel.
-
setErrorChannelName
Description copied from class:MessagingGatewaySupport
Set the error channel name. If no error channel is provided, this gateway will propagate Exceptions to the caller. To completely suppress Exceptions, provide a reference to the "nullChannel" here.- Overrides:
setErrorChannelName
in classMessagingGatewaySupport
- Parameters:
errorChannelName
- The error channel bean name.
-
setRequestTimeout
public void setRequestTimeout(long requestTimeout) Description copied from class:MessagingGatewaySupport
Set the timeout value for sending request messages. If not explicitly configured, the default is one second.- Overrides:
setRequestTimeout
in classMessagingGatewaySupport
- Parameters:
requestTimeout
- the timeout value in milliseconds
-
setReplyTimeout
public void setReplyTimeout(long replyTimeout) Description copied from class:MessagingGatewaySupport
Set the timeout value for receiving reply messages. If not explicitly configured, the default is one second.- Overrides:
setReplyTimeout
in classMessagingGatewaySupport
- Parameters:
replyTimeout
- the timeout value in milliseconds
-
setErrorOnTimeout
public void setErrorOnTimeout(boolean errorOnTimeout) Description copied from class:MessagingGatewaySupport
If errorOnTimeout is true, construct an instance that will send anErrorMessage
with aMessageTimeoutException
payload to the error channel if a reply is expected but none is received. If no error channel is configured, theMessageTimeoutException
will be thrown.- Overrides:
setErrorOnTimeout
in classMessagingGatewaySupport
- Parameters:
errorOnTimeout
- true to create the error message on reply timeout.
-
setShouldTrack
public void setShouldTrack(boolean shouldTrack) Description copied from class:MessagingGatewaySupport
Specify whether this gateway should be tracked in the Message History of Messages that originate from its send or sendAndReceive operations.- Specified by:
setShouldTrack
in interfaceTrackableComponent
- Overrides:
setShouldTrack
in classMessagingGatewaySupport
-
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
-
registerMetricsCaptor
Description copied from interface:IntegrationManagement
Inject aMetricsCaptor
. Ignored ifObservationRegistry
is provided.- Specified by:
registerMetricsCaptor
in interfaceIntegrationManagement
- Overrides:
registerMetricsCaptor
in classMessagingGatewaySupport
- Parameters:
metricsCaptorToRegister
- 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 classMessagingGatewaySupport
- Parameters:
observationRegistry
- theObservationRegistry
to expose observations from the component.- See Also:
-
setObservationConvention
public void setObservationConvention(MessageRequestReplyReceiverObservationConvention observationConvention) - Overrides:
setObservationConvention
in classMessagingGatewaySupport
-
getComponentType
Description copied from class:IntegrationObjectSupport
Subclasses may implement this method to provide component type information.- Specified by:
getComponentType
in interfaceNamedComponent
- Overrides:
getComponentType
in classMessagingGatewaySupport
-
setApplicationContext
- Specified by:
setApplicationContext
in interfaceApplicationContextAware
- Overrides:
setApplicationContext
in classIntegrationObjectSupport
- Throws:
BeansException
-
onInit
protected void onInit()Description copied from class:IntegrationObjectSupport
Subclasses may implement this for initialization logic.- Overrides:
onInit
in classMessagingGatewaySupport
-
getListener
-
doStart
protected void doStart()Description copied from class:AbstractEndpoint
Subclasses must implement this method with the start behavior. This method will be invoked while holding theAbstractEndpoint.lifecycleLock
.- Overrides:
doStart
in classMessagingGatewaySupport
-
doStop
protected void doStop()Description copied from class:AbstractEndpoint
Subclasses must implement this method with the stop behavior. This method will be invoked while holding theAbstractEndpoint.lifecycleLock
.- Overrides:
doStop
in classMessagingGatewaySupport
-
destroy
public void destroy()- Specified by:
destroy
in interfaceDisposableBean
- Specified by:
destroy
in interfaceIntegrationManagement
- Overrides:
destroy
in classMessagingGatewaySupport
-
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.
-