Class ReplyManagerSupport
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.component.sjms.reply.ReplyManagerSupport
- All Implemented Interfaces:
AutoCloseable
,ReplyManager
,SessionMessageListener
,org.apache.camel.Service
,org.apache.camel.ShutdownableService
,org.apache.camel.StatefulService
,org.apache.camel.SuspendableService
- Direct Known Subclasses:
QueueReplyManager
,TemporaryQueueReplyManager
public abstract class ReplyManagerSupport
extends org.apache.camel.support.service.ServiceSupport
implements ReplyManager
Base class for
ReplyManager
implementations.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.camel.CamelContext
protected org.apache.camel.component.sjms.reply.CorrelationTimeoutMap
protected SjmsEndpoint
protected ExecutorService
protected MessageListenerContainer
protected final org.slf4j.Logger
protected jakarta.jms.Destination
protected final CountDownLatch
protected final long
protected ScheduledExecutorService
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract MessageListenerContainer
protected void
doStart()
protected void
doStop()
jakarta.jms.Destination
Gets the reply to queue being usedprotected abstract void
handleReplyMessage
(String correlationID, jakarta.jms.Message message, jakarta.jms.Session session) void
onMessage
(jakarta.jms.Message message, jakarta.jms.Session session) void
processReply
(ReplyHolder holder) Process the replyregisterReply
(ReplyManager replyManager, org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback, String originalCorrelationId, String correlationId, long requestTimeout) Register a replyvoid
setEndpoint
(SjmsEndpoint endpoint) Sets the belongingSjmsEndpoint
.void
setOnTimeoutExecutorService
(ExecutorService executorService) Sets the thread pool to use for continue routingExchange
when a timeout was triggered when doing request/reply over JMS.void
setReplyTo
(jakarta.jms.Destination replyTo) Sets the reply to queue the manager should listen for replies.void
setScheduledExecutorService
(ScheduledExecutorService executorService) Sets the scheduled thread pool to use when checking for timeouts (no reply received within a given time period)Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.camel.component.sjms.reply.ReplyManager
updateCorrelationId
Methods inherited from interface org.apache.camel.Service
build, close, init, start, stop
Methods inherited from interface org.apache.camel.ShutdownableService
shutdown
Methods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
Methods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Field Details
-
log
protected final org.slf4j.Logger log -
camelContext
protected final org.apache.camel.CamelContext camelContext -
scheduledExecutorService
-
executorService
-
endpoint
-
replyTo
protected jakarta.jms.Destination replyTo -
listenerContainer
-
replyToLatch
-
replyToTimeout
protected final long replyToTimeout- See Also:
-
correlation
protected org.apache.camel.component.sjms.reply.CorrelationTimeoutMap correlation
-
-
Constructor Details
-
ReplyManagerSupport
public ReplyManagerSupport(org.apache.camel.CamelContext camelContext)
-
-
Method Details
-
setScheduledExecutorService
Description copied from interface:ReplyManager
Sets the scheduled thread pool to use when checking for timeouts (no reply received within a given time period)- Specified by:
setScheduledExecutorService
in interfaceReplyManager
-
setOnTimeoutExecutorService
Description copied from interface:ReplyManager
Sets the thread pool to use for continue routingExchange
when a timeout was triggered when doing request/reply over JMS.- Specified by:
setOnTimeoutExecutorService
in interfaceReplyManager
-
setEndpoint
Description copied from interface:ReplyManager
Sets the belongingSjmsEndpoint
.- Specified by:
setEndpoint
in interfaceReplyManager
-
setReplyTo
public void setReplyTo(jakarta.jms.Destination replyTo) Description copied from interface:ReplyManager
Sets the reply to queue the manager should listen for replies. The queue is either a temporary or a persistent queue.- Specified by:
setReplyTo
in interfaceReplyManager
-
getReplyTo
public jakarta.jms.Destination getReplyTo()Description copied from interface:ReplyManager
Gets the reply to queue being used- Specified by:
getReplyTo
in interfaceReplyManager
-
registerReply
public String registerReply(ReplyManager replyManager, org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback, String originalCorrelationId, String correlationId, long requestTimeout) Description copied from interface:ReplyManager
Register a reply- Specified by:
registerReply
in interfaceReplyManager
- Parameters:
replyManager
- the reply manager being usedexchange
- the exchangecallback
- the callbackoriginalCorrelationId
- an optional original correlation idcorrelationId
- the correlation id to expect being usedrequestTimeout
- the timeout- Returns:
- the correlation id used
-
onMessage
public void onMessage(jakarta.jms.Message message, jakarta.jms.Session session) throws jakarta.jms.JMSException - Specified by:
onMessage
in interfaceSessionMessageListener
- Throws:
jakarta.jms.JMSException
-
processReply
Description copied from interface:ReplyManager
Process the reply- Specified by:
processReply
in interfaceReplyManager
- Parameters:
holder
- containing needed data to process the reply and continue routing
-
handleReplyMessage
protected abstract void handleReplyMessage(String correlationID, jakarta.jms.Message message, jakarta.jms.Session session) -
createListenerContainer
- Throws:
Exception
-
doStart
- Overrides:
doStart
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doStop
- Overrides:
doStop
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-