org.apache.camel.component.jms.reply
Class ReplyManagerSupport

java.lang.Object
  extended by org.apache.camel.support.ServiceSupport
      extended by org.apache.camel.component.jms.reply.ReplyManagerSupport
All Implemented Interfaces:
javax.jms.MessageListener, ReplyManager, 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.ServiceSupport
implements ReplyManager

Base class for ReplyManager implementations.

Version:

Field Summary
protected  org.apache.camel.CamelContext camelContext
           
protected  CorrelationTimeoutMap correlation
           
protected  JmsEndpoint endpoint
           
protected  ScheduledExecutorService executorService
           
protected  org.springframework.jms.listener.AbstractMessageListenerContainer listenerContainer
           
protected  org.slf4j.Logger log
           
protected  javax.jms.Destination replyTo
           
protected  CountDownLatch replyToLatch
           
protected  long replyToTimeout
           
 
Fields inherited from class org.apache.camel.support.ServiceSupport
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
 
Constructor Summary
ReplyManagerSupport(org.apache.camel.CamelContext camelContext)
           
 
Method Summary
protected abstract  org.springframework.jms.listener.AbstractMessageListenerContainer createListenerContainer()
           
protected  void doStart()
           
protected  void doStop()
           
 javax.jms.Destination getReplyTo()
          Gets the reply to queue being used
protected abstract  void handleReplyMessage(String correlationID, javax.jms.Message message)
           
 void onMessage(javax.jms.Message message)
           
 void processReply(ReplyHolder holder)
          Process the reply
 void setEndpoint(JmsEndpoint endpoint)
          Sets the belonging JmsEndpoint.
 void setReplyTo(javax.jms.Destination replyTo)
          Sets the reply to queue the manager should listen for replies.
 void setScheduledExecutorService(ScheduledExecutorService executorService)
          Sets the scheduled to use when checking for timeouts (no reply received within a given time period)
protected  ReplyHandler waitForProvisionCorrelationToBeUpdated(String correlationID, javax.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.ServiceSupport
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, 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.jms.reply.ReplyManager
registerReply, setReplyToSelectorHeader, updateCorrelationId
 

Field Detail

log

protected final org.slf4j.Logger log

camelContext

protected final org.apache.camel.CamelContext camelContext

executorService

protected ScheduledExecutorService executorService

endpoint

protected JmsEndpoint endpoint

replyTo

protected javax.jms.Destination replyTo

listenerContainer

protected org.springframework.jms.listener.AbstractMessageListenerContainer listenerContainer

replyToLatch

protected final CountDownLatch replyToLatch

replyToTimeout

protected final long replyToTimeout
See Also:
Constant Field Values

correlation

protected CorrelationTimeoutMap correlation
Constructor Detail

ReplyManagerSupport

public ReplyManagerSupport(org.apache.camel.CamelContext camelContext)
Method Detail

setScheduledExecutorService

public void setScheduledExecutorService(ScheduledExecutorService executorService)
Description copied from interface: ReplyManager
Sets the scheduled to use when checking for timeouts (no reply received within a given time period)

Specified by:
setScheduledExecutorService in interface ReplyManager

setEndpoint

public void setEndpoint(JmsEndpoint endpoint)
Description copied from interface: ReplyManager
Sets the belonging JmsEndpoint.

Specified by:
setEndpoint in interface ReplyManager

setReplyTo

public void setReplyTo(javax.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 interface ReplyManager

getReplyTo

public javax.jms.Destination getReplyTo()
Description copied from interface: ReplyManager
Gets the reply to queue being used

Specified by:
getReplyTo in interface ReplyManager

onMessage

public void onMessage(javax.jms.Message message)
Specified by:
onMessage in interface javax.jms.MessageListener

processReply

public void processReply(ReplyHolder holder)
Description copied from interface: ReplyManager
Process the reply

Specified by:
processReply in interface ReplyManager
Parameters:
holder - containing needed data to process the reply and continue routing

handleReplyMessage

protected abstract void handleReplyMessage(String correlationID,
                                           javax.jms.Message message)

createListenerContainer

protected abstract org.springframework.jms.listener.AbstractMessageListenerContainer createListenerContainer()
                                                                                                      throws Exception
Throws:
Exception

waitForProvisionCorrelationToBeUpdated

protected ReplyHandler waitForProvisionCorrelationToBeUpdated(String correlationID,
                                                              javax.jms.Message message)
IMPORTANT: This logic is only being used due to high performance in-memory only testing using InOut over JMS. Its 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 it's internal correlation map.


doStart

protected void doStart()
                throws Exception
Specified by:
doStart in class org.apache.camel.support.ServiceSupport
Throws:
Exception

doStop

protected void doStop()
               throws Exception
Specified by:
doStop in class org.apache.camel.support.ServiceSupport
Throws:
Exception


Apache Camel