org.mule.routing.requestreply
Class AbstractAsyncRequestReplyRequester

java.lang.Object
  extended by org.mule.processor.AbstractInterceptingMessageProcessor
      extended by org.mule.routing.requestreply.AbstractAsyncRequestReplyRequester
All Implemented Interfaces:
FlowConstructAware, MuleContextAware, InterceptingMessageProcessor, MessageProcessor, RequestReplyRequesterMessageProcessor, MessageSource
Direct Known Subclasses:
ServiceAsyncRequestReplyRequestor, SimpleAsyncRequestReplyRequester

public abstract class AbstractAsyncRequestReplyRequester
extends AbstractInterceptingMessageProcessor
implements RequestReplyRequesterMessageProcessor, FlowConstructAware


Field Summary
protected  boolean failOnTimeout
           
protected  FlowConstruct flowConstruct
           
protected  Map<String,Latch> locks
           
static int MAX_PROCESSED_GROUPS
           
protected  org.apache.commons.collections.buffer.BoundedFifoBuffer processed
           
protected  Object processedLock
           
protected  MessageSource replyMessageSource
           
protected  edu.emory.mathcs.backport.java.util.concurrent.ConcurrentMap responseEvents
           
protected  long timeout
           
 
Fields inherited from class org.mule.processor.AbstractInterceptingMessageProcessor
logger, muleContext, next, notificationHandler
 
Constructor Summary
AbstractAsyncRequestReplyRequester()
           
 
Method Summary
protected  void addProcessed(Object id)
           
protected  Latch createEventLock()
          Creates the lock used to synchronize a given event
protected  String getAsyncReplyCorrelationId(MuleEvent event)
           
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 setTimeout(long timeout)
           
 String toString()
           
protected  void verifyReplyMessageSource(MessageSource messageSource)
           
 
Methods inherited from class org.mule.processor.AbstractInterceptingMessageProcessor
fireNotification, getMuleContext, processNext, setListener, setMuleContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mule.api.source.MessageSource
setListener
 

Field Detail

MAX_PROCESSED_GROUPS

public static final int MAX_PROCESSED_GROUPS
See Also:
Constant Field Values

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 edu.emory.mathcs.backport.java.util.concurrent.ConcurrentMap responseEvents

processedLock

protected final Object processedLock

processed

protected final org.apache.commons.collections.buffer.BoundedFifoBuffer processed
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

createEventLock

protected Latch createEventLock()
Creates the lock used to synchronize a given event

Returns:
a new Latch instance

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

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 ResponseTimeoutException
Throws:
ResponseTimeoutException

postLatchAwait

protected void postLatchAwait(String asyncReplyCorrelationId)

addProcessed

protected void addProcessed(Object id)

isAlreadyProcessed

protected boolean isAlreadyProcessed(Object id)

toString

public String toString()
Overrides:
toString in class AbstractInterceptingMessageProcessor

setFlowConstruct

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


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