org.mule.routing.requestreply
Class AbstractAsyncRequestReplyRequester

java.lang.Object
  extended by org.mule.processor.AbstractInterceptingMessageProcessorBase
      extended by org.mule.routing.requestreply.AbstractAsyncRequestReplyRequester
All Implemented Interfaces:
AnnotatedObject, FlowConstructAware, MuleContextAware, Disposable, Initialisable, Startable, Stoppable, MessageProcessor, RequestReplyRequesterMessageProcessor
Direct Known Subclasses:
ServiceAsyncRequestReplyRequestor, SimpleAsyncRequestReplyRequester

public abstract class AbstractAsyncRequestReplyRequester
extends AbstractInterceptingMessageProcessorBase
implements RequestReplyRequesterMessageProcessor, FlowConstructAware, Initialisable, Startable, Stoppable, Disposable


Field Summary
protected  boolean failOnTimeout
           
protected  FlowConstruct flowConstruct
           
protected  Map<String,Latch> locks
           
static int MAX_PROCESSED_GROUPS
           
protected  String name
           
static String NAME_TEMPLATE
           
protected  BoundedFifoBuffer processed
           
protected  Object processedLock
           
protected  MessageSource replyMessageSource
           
protected  ConcurrentMap<String,MuleEvent> responseEvents
           
protected  ListableObjectStore store
           
protected  long timeout
           
static int UNCLAIMED_INTERVAL
           
static int UNCLAIMED_TIME_TO_LIVE
           
 
Fields inherited from class org.mule.processor.AbstractInterceptingMessageProcessorBase
logger, muleContext, next, notificationHandler
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Startable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Stoppable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Fields inherited from interface org.mule.api.AnnotatedObject
PROPERTY_NAME
 
Constructor Summary
AbstractAsyncRequestReplyRequester()
           
 
Method Summary
protected  void addProcessed(Object id)
           
 void dispose()
          A lifecycle method where implementor should free up any resources.
protected  String getAsyncReplyCorrelationId(MuleEvent event)
           
 void initialise()
          Method used to perform any initialisation work.
protected  boolean isAlreadyProcessed(Object id)
           
protected  void postLatchAwait(String asyncReplyCorrelationId)
           
 MuleEvent process(MuleEvent event)
          Invokes the MessageProcessor.
protected  MuleEvent receiveAsyncReply(MuleEvent event)
           
protected  void sendAsyncRequest(MuleEvent event)
           
 void setFailOnTimeout(boolean failOnTimeout)
           
 void setFlowConstruct(FlowConstruct flowConstruct)
           
 void setReplySource(MessageSource messageSource)
           
 void setStorePrefix(String storePrefix)
           
 void setTimeout(long timeout)
           
 void start()
           
 void stop()
           
 String toString()
           
protected  void verifyReplyMessageSource(MessageSource messageSource)
           
 
Methods inherited from class org.mule.processor.AbstractInterceptingMessageProcessorBase
getAnnotation, getAnnotations, getListener, getMuleContext, isEventValid, processNext, setAnnotations, setListener, setMuleContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_PROCESSED_GROUPS

public static final int MAX_PROCESSED_GROUPS
See Also:
Constant Field Values

UNCLAIMED_TIME_TO_LIVE

public static final int UNCLAIMED_TIME_TO_LIVE
See Also:
Constant Field Values

UNCLAIMED_INTERVAL

public static int UNCLAIMED_INTERVAL

NAME_TEMPLATE

public static final String NAME_TEMPLATE
See Also:
Constant Field Values

name

protected String name

timeout

protected volatile long timeout

failOnTimeout

protected volatile boolean failOnTimeout

replyMessageSource

protected MessageSource replyMessageSource

flowConstruct

protected FlowConstruct flowConstruct

locks

protected final Map<String,Latch> locks

responseEvents

protected final ConcurrentMap<String,MuleEvent> responseEvents

processedLock

protected final Object processedLock

processed

protected final BoundedFifoBuffer processed

store

protected ListableObjectStore store
Constructor Detail

AbstractAsyncRequestReplyRequester

public AbstractAsyncRequestReplyRequester()
Method Detail

process

public MuleEvent process(MuleEvent event)
                  throws MuleException
Description copied from interface: MessageProcessor
Invokes the MessageProcessor.

Specified by:
process in interface MessageProcessor
Parameters:
event - MuleEvent to be processed
Returns:
optional response MuleEvent
Throws:
MuleException

setTimeout

public void setTimeout(long timeout)

setFailOnTimeout

public void setFailOnTimeout(boolean failOnTimeout)

setReplySource

public void setReplySource(MessageSource messageSource)
Specified by:
setReplySource in interface RequestReplyRequesterMessageProcessor
Parameters:
messageSource - the message source that will be used to receive the reply message

initialise

public void initialise()
                throws InitialisationException
Description copied from interface: Initialisable
Method used to perform any initialisation work. If a fatal error occurs during initialisation an InitialisationException should be thrown, causing the Mule instance to shutdown. If the error is recoverable, say by retrying to connect, a RecoverableException should be thrown. There is no guarantee that by throwing a Recoverable exception that the Mule instance will not shut down.

Specified by:
initialise in interface Initialisable
Throws:
InitialisationException - if a fatal error occurs causing the Mule instance to shutdown
RecoverableException - if an error occurs that can be recovered from

start

public void start()
           throws MuleException
Specified by:
start in interface Startable
Throws:
MuleException

stop

public void stop()
          throws MuleException
Specified by:
stop in interface Stoppable
Throws:
MuleException

dispose

public void dispose()
Description copied from interface: Disposable
A lifecycle method where implementor should free up any resources. If an exception is thrown it should just be logged and processing should continue. This method should not throw Runtime exceptions.

Specified by:
dispose in interface Disposable

setStorePrefix

public void setStorePrefix(String storePrefix)

verifyReplyMessageSource

protected void verifyReplyMessageSource(MessageSource messageSource)

getAsyncReplyCorrelationId

protected String getAsyncReplyCorrelationId(MuleEvent event)

sendAsyncRequest

protected void sendAsyncRequest(MuleEvent event)
                         throws MuleException
Throws:
MuleException

receiveAsyncReply

protected MuleEvent receiveAsyncReply(MuleEvent event)
                               throws MessagingException
Throws:
MessagingException

postLatchAwait

protected void postLatchAwait(String asyncReplyCorrelationId)
                       throws MessagingException
Throws:
MessagingException

addProcessed

protected void addProcessed(Object id)

isAlreadyProcessed

protected boolean isAlreadyProcessed(Object id)

toString

public String toString()
Overrides:
toString in class AbstractInterceptingMessageProcessorBase

setFlowConstruct

public void setFlowConstruct(FlowConstruct flowConstruct)
Specified by:
setFlowConstruct in interface FlowConstructAware


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.