Class ReplyManagerSupport
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.component.jms.reply.ReplyManagerSupport
- All Implemented Interfaces:
AutoCloseable,ReplyManager,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.StatefulService,org.apache.camel.SuspendableService,org.springframework.jms.listener.SessionAwareMessageListener
- 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.CamelContextprotected org.apache.camel.component.jms.reply.CorrelationTimeoutMapprotected Stringprotected JmsEndpointprotected ExecutorServiceprotected org.springframework.jms.listener.AbstractMessageListenerContainerprotected final org.slf4j.Loggerprotected jakarta.jms.Destinationprotected ScheduledExecutorServiceFields 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
ConstructorsModifierConstructorDescriptionprotectedReplyManagerSupport(org.apache.camel.CamelContext camelContext) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract org.springframework.jms.listener.AbstractMessageListenerContainerprotected abstract ReplyHandlercreateReplyHandler(ReplyManager replyManager, org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback, String originalCorrelationId, String correlationId, long requestTimeout) protected voiddoStart()protected voiddoStop()protected static org.springframework.jms.listener.AbstractMessageListenerContainerjakarta.jms.DestinationGets the reply to queue being usedprotected abstract voidhandleReplyMessage(String correlationID, jakarta.jms.Message message, jakarta.jms.Session session) voidonMessage(jakarta.jms.Message message, jakarta.jms.Session session) voidprocessReply(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 replyvoidsetCorrelationProperty(String correlationProperty) Sets the JMS message property used for message correlation.voidsetEndpoint(JmsEndpoint endpoint) Sets the belongingJmsEndpoint.voidsetOnTimeoutExecutorService(ExecutorService executorService) Sets the thread pool to use for continue routingExchangewhen a timeout was triggered when doing request/reply over JMS.voidsetReplyTo(jakarta.jms.Destination replyTo) Sets the reply to queue the manager should listen for replies.voidsetScheduledExecutorService(ScheduledExecutorService executorService) Sets the scheduled thread pool to use when checking for timeouts (no reply received within a given time period)protected static voidsetupClientId(JmsEndpoint endpoint, org.springframework.jms.listener.DefaultMessageListenerContainer answer) protected ReplyHandlerwaitForProvisionCorrelationToBeUpdated(String correlationID, jakarta.jms.Message message) IMPORTANT: This logic is only being used due to high performance in-memory only testing using InOut over JMS.Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getInternalLock, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.camel.component.jms.reply.ReplyManager
setReplyToSelectorHeader, updateCorrelationIdMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods 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 volatile jakarta.jms.Destination replyTo -
listenerContainer
protected org.springframework.jms.listener.AbstractMessageListenerContainer listenerContainer -
correlation
protected org.apache.camel.component.jms.reply.CorrelationTimeoutMap correlation -
correlationProperty
-
-
Constructor Details
-
ReplyManagerSupport
protected ReplyManagerSupport(org.apache.camel.CamelContext camelContext)
-
-
Method Details
-
setScheduledExecutorService
Description copied from interface:ReplyManagerSets the scheduled thread pool to use when checking for timeouts (no reply received within a given time period)- Specified by:
setScheduledExecutorServicein interfaceReplyManager
-
setOnTimeoutExecutorService
Description copied from interface:ReplyManagerSets the thread pool to use for continue routingExchangewhen a timeout was triggered when doing request/reply over JMS.- Specified by:
setOnTimeoutExecutorServicein interfaceReplyManager
-
setEndpoint
Description copied from interface:ReplyManagerSets the belongingJmsEndpoint.- Specified by:
setEndpointin interfaceReplyManager
-
setReplyTo
public void setReplyTo(jakarta.jms.Destination replyTo) Description copied from interface:ReplyManagerSets the reply to queue the manager should listen for replies. The queue is either a temporary or a persistent queue.- Specified by:
setReplyToin interfaceReplyManager
-
setCorrelationProperty
Description copied from interface:ReplyManagerSets the JMS message property used for message correlation. If set message correlation will be performed on the value of this JMS property, JMSCorrelationID will be ignored.- Specified by:
setCorrelationPropertyin interfaceReplyManager
-
getReplyTo
public jakarta.jms.Destination getReplyTo()Description copied from interface:ReplyManagerGets the reply to queue being used- Specified by:
getReplyToin 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:ReplyManagerRegister a reply- Specified by:
registerReplyin 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
-
createReplyHandler
protected abstract ReplyHandler createReplyHandler(ReplyManager replyManager, org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback, String originalCorrelationId, String correlationId, long requestTimeout) -
onMessage
public void onMessage(jakarta.jms.Message message, jakarta.jms.Session session) throws jakarta.jms.JMSException - Specified by:
onMessagein interfaceorg.springframework.jms.listener.SessionAwareMessageListener- Throws:
jakarta.jms.JMSException
-
processReply
Description copied from interface:ReplyManagerProcess the reply- Specified by:
processReplyin 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
protected abstract org.springframework.jms.listener.AbstractMessageListenerContainer createListenerContainer() throws Exception- Throws:
Exception
-
waitForProvisionCorrelationToBeUpdated
protected ReplyHandler waitForProvisionCorrelationToBeUpdated(String correlationID, jakarta.jms.Message message) IMPORTANT: This logic is only being used due to high performance in-memory only testing using InOut over JMS. It is unlikely to happen in a real life situation with communication to a remote broker, which always will be slower to send back reply, before Camel had a chance to update the internal correlation map. -
doStart
- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
setupClientId
protected static void setupClientId(JmsEndpoint endpoint, org.springframework.jms.listener.DefaultMessageListenerContainer answer) -
getAbstractMessageListenerContainer
protected static org.springframework.jms.listener.AbstractMessageListenerContainer getAbstractMessageListenerContainer(JmsEndpoint endpoint)
-