org.mule.routing
Class IdempotentMessageFilter

java.lang.Object
  extended by org.mule.processor.AbstractInterceptingMessageProcessorBase
      extended by org.mule.processor.AbstractInterceptingMessageProcessor
          extended by org.mule.processor.AbstractFilteringMessageProcessor
              extended by org.mule.routing.IdempotentMessageFilter
All Implemented Interfaces:
AnnotatedObject, FlowConstructAware, MuleContextAware, Initialisable, InterceptingMessageProcessor, MessageProcessor, MessageProcessorContainer, MessageSource
Direct Known Subclasses:
IdempotentSecureHashMessageFilter

public class IdempotentMessageFilter
extends AbstractFilteringMessageProcessor
implements FlowConstructAware, Initialisable

IdempotentMessageFilter ensures that only unique messages are passed on. It does this by checking the unique ID of the incoming message. Note that the underlying endpoint must support unique message IDs for this to work, otherwise a UniqueIdNotSupportedException is thrown.

EIP Reference: http://www.eaipatterns.com/IdempotentReceiver.html


Field Summary
protected  FlowConstruct flowConstruct
           
protected  String idExpression
           
protected  ObjectStore<String> store
           
protected  String storePrefix
           
protected  String valueExpression
           
 
Fields inherited from class org.mule.processor.AbstractFilteringMessageProcessor
onUnacceptedFlowConstruct, throwOnUnaccepted, unacceptedMessageProcessor
 
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.AnnotatedObject
PROPERTY_NAME
 
Constructor Summary
IdempotentMessageFilter()
           
 
Method Summary
protected  boolean accept(MuleEvent event)
           
protected  boolean acceptMessageForFlowConstruct(MuleEvent event)
           
protected  ObjectStore<String> createMessageIdStore()
           
 String getIdExpression()
           
protected  String getIdForEvent(MuleEvent event)
           
 ObjectStore<String> getStore()
           
 String getValueExpression()
           
protected  String getValueForEvent(MuleEvent event)
           
 void initialise()
          Method used to perform any initialisation work.
protected  boolean isNewMessage(MuleEvent event)
           
protected  MuleEvent processNext(MuleEvent event)
           
 void setFlowConstruct(FlowConstruct flowConstruct)
           
 void setIdExpression(String idExpression)
           
 void setStore(ObjectStore<String> store)
           
 void setStorePrefix(String storePrefix)
           
 void setValueExpression(String valueExpression)
           
 
Methods inherited from class org.mule.processor.AbstractFilteringMessageProcessor
filterUnacceptedException, getUnacceptedMessageProcessor, handleUnaccepted, isThrowOnUnaccepted, process, setThrowOnUnaccepted, setUnacceptedMessageProcessor
 
Methods inherited from class org.mule.processor.AbstractInterceptingMessageProcessorBase
addMessageProcessorPathElements, getAnnotation, getAnnotations, getListener, getMuleContext, isEventValid, setAnnotations, setListener, setMuleContext, toString
 
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

store

protected volatile ObjectStore<String> store

flowConstruct

protected FlowConstruct flowConstruct

storePrefix

protected String storePrefix

idExpression

protected String idExpression

valueExpression

protected String valueExpression
Constructor Detail

IdempotentMessageFilter

public IdempotentMessageFilter()
Method Detail

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

createMessageIdStore

protected ObjectStore<String> createMessageIdStore()
                                            throws InitialisationException
Throws:
InitialisationException

processNext

protected MuleEvent processNext(MuleEvent event)
                         throws MuleException
Overrides:
processNext in class AbstractInterceptingMessageProcessorBase
Throws:
MuleException

getValueForEvent

protected String getValueForEvent(MuleEvent event)
                           throws MessagingException
Throws:
MessagingException

getIdForEvent

protected String getIdForEvent(MuleEvent event)
                        throws MessagingException
Throws:
MessagingException

getIdExpression

public String getIdExpression()

setIdExpression

public void setIdExpression(String idExpression)

getStore

public ObjectStore<String> getStore()

setStore

public void setStore(ObjectStore<String> store)

accept

protected boolean accept(MuleEvent event)
Specified by:
accept in class AbstractFilteringMessageProcessor

acceptMessageForFlowConstruct

protected boolean acceptMessageForFlowConstruct(MuleEvent event)

isNewMessage

protected boolean isNewMessage(MuleEvent event)

setFlowConstruct

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

getValueExpression

public String getValueExpression()

setValueExpression

public void setValueExpression(String valueExpression)

setStorePrefix

public void setStorePrefix(String storePrefix)


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