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

java.lang.Object
  extended by org.apache.camel.impl.ServiceSupport
      extended by org.apache.camel.component.jms.reply.ReplyManagerSupport
All Implemented Interfaces:
MessageListener, ReplyManager, Service, ShutdownableService
Direct Known Subclasses:
PersistentQueueReplyManager, TemporaryQueueReplyManager

public abstract class ReplyManagerSupport
extends ServiceSupport
implements ReplyManager

Base class for ReplyManager implementations.

Version:
$Revision: 20573 $

Field Summary
protected  CorrelationMap correlation
           
protected  JmsEndpoint endpoint
           
protected  ScheduledExecutorService executorService
           
protected  AbstractMessageListenerContainer listenerContainer
           
protected  org.apache.commons.logging.Log log
           
protected  Destination replyTo
           
protected  long replyToResolverTimeout
           
 
Constructor Summary
ReplyManagerSupport()
           
 
Method Summary
protected abstract  AbstractMessageListenerContainer createListenerContainer()
           
protected  void doStart()
           
protected  void doStop()
           
 Destination getReplyTo()
          Gets the reply to queue being used
protected abstract  void handleReplyMessage(String correlationID, Message message)
           
 void onMessage(Message message)
           
 void processReply(ReplyHolder holder)
          Process the reply
 void setEndpoint(JmsEndpoint endpoint)
          Sets the belonging JmsEndpoint.
 void setReplyTo(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, 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.impl.ServiceSupport
addChildService, doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, removeChildService, resume, shutdown, start, 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.apache.commons.logging.Log log

executorService

protected ScheduledExecutorService executorService

endpoint

protected JmsEndpoint endpoint

replyTo

protected Destination replyTo

listenerContainer

protected AbstractMessageListenerContainer listenerContainer

replyToResolverTimeout

protected long replyToResolverTimeout

correlation

protected CorrelationMap correlation
Constructor Detail

ReplyManagerSupport

public ReplyManagerSupport()
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(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 Destination getReplyTo()
Description copied from interface: ReplyManager
Gets the reply to queue being used

Specified by:
getReplyTo in interface ReplyManager

onMessage

public void onMessage(Message message)
Specified by:
onMessage in interface 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,
                                           Message message)

createListenerContainer

protected abstract AbstractMessageListenerContainer createListenerContainer()
                                                                     throws Exception
Throws:
Exception

waitForProvisionCorrelationToBeUpdated

protected ReplyHandler waitForProvisionCorrelationToBeUpdated(String correlationID,
                                                              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 ServiceSupport
Throws:
Exception

doStop

protected void doStop()
               throws Exception
Specified by:
doStop in class ServiceSupport
Throws:
Exception


Apache CAMEL