public class IdempotentMessageFilter extends AbstractFilteringMessageProcessor implements FlowConstructAware, Initialisable, Disposable
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
Modifier and Type | Field and Description |
---|---|
protected FlowConstruct |
flowConstruct |
protected String |
idExpression |
protected ObjectStore<String> |
store |
protected String |
storePrefix |
protected String |
valueExpression |
onUnacceptedFlowConstruct, throwOnUnaccepted, unacceptedMessageProcessor
logger, muleContext, next, notificationHandler
PHASE_NAME
PHASE_NAME
PROPERTY_NAME
Constructor and Description |
---|
IdempotentMessageFilter() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
accept(MuleEvent event) |
protected boolean |
acceptMessageForFlowConstruct(MuleEvent event) |
protected ObjectStore<String> |
createMessageIdStore() |
void |
dispose()
A lifecycle method where implementor should free up any resources.
|
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) |
filterFailureException, filterUnacceptedException, getUnacceptedMessageProcessor, handleUnaccepted, isThrowOnUnaccepted, process, setThrowOnUnaccepted, setUnacceptedMessageProcessor
addMessageProcessorPathElements, getListener, getMuleContext, isEventValid, setListener, setMuleContext, toString
getAnnotation, getAnnotations, setAnnotations
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
setListener
protected volatile ObjectStore<String> store
protected FlowConstruct flowConstruct
protected String storePrefix
protected String idExpression
protected String valueExpression
public void initialise() throws InitialisationException
Initialisable
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.initialise
in interface Initialisable
InitialisationException
- if a fatal error occurs causing the Mule instance to shutdownRecoverableException
- if an error occurs that can be recovered frompublic void dispose()
Disposable
dispose
in interface Disposable
protected ObjectStore<String> createMessageIdStore() throws InitialisationException
InitialisationException
protected MuleEvent processNext(MuleEvent event) throws MuleException
processNext
in class AbstractInterceptingMessageProcessorBase
MuleException
protected String getValueForEvent(MuleEvent event) throws MessagingException
MessagingException
protected String getIdForEvent(MuleEvent event) throws MessagingException
MessagingException
public String getIdExpression()
public void setIdExpression(String idExpression)
public ObjectStore<String> getStore()
public void setStore(ObjectStore<String> store)
protected boolean accept(MuleEvent event)
accept
in class AbstractFilteringMessageProcessor
protected boolean acceptMessageForFlowConstruct(MuleEvent event)
protected boolean isNewMessage(MuleEvent event)
public void setFlowConstruct(FlowConstruct flowConstruct)
setFlowConstruct
in interface FlowConstructAware
public String getValueExpression()
public void setValueExpression(String valueExpression)
public void setStorePrefix(String storePrefix)
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.