org.mule.routing.inbound
Class IdempotentReceiver
java.lang.Object
org.mule.routing.AbstractRouter
org.mule.routing.inbound.SelectiveConsumer
org.mule.routing.inbound.IdempotentReceiver
- All Implemented Interfaces:
- MuleContextAware, Disposable, Initialisable, InboundRouter, Router
- Direct Known Subclasses:
- IdempotentSecureHashReceiver
public class IdempotentReceiver
- extends SelectiveConsumer
IdempotentReceiver
ensures that only unique messages are received by a
service. 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.
By default this implementation uses an instance of
IdempotentInMemoryMessageIdStore
.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
idStore
protected volatile IdempotentMessageIdStore idStore
assignedComponentName
protected volatile String assignedComponentName
maxMessages
protected volatile int maxMessages
messageTTL
protected volatile int messageTTL
expirationInterval
protected volatile int expirationInterval
IdempotentReceiver
public IdempotentReceiver()
getMaxMessages
public int getMaxMessages()
setMaxMessages
public void setMaxMessages(int maxMessages)
getMessageTTL
public int getMessageTTL()
setMessageTTL
public void setMessageTTL(int messageTTL)
getExpirationInterval
public int getExpirationInterval()
setExpirationInterval
public void setExpirationInterval(int expirationInterval)
initialize
protected void initialize(MuleEvent event)
throws RoutingException
- Throws:
RoutingException
createMessageIdStore
protected IdempotentMessageIdStore createMessageIdStore()
isMatch
public boolean isMatch(MuleEvent event)
throws MessagingException
- Description copied from interface:
InboundRouter
- Determines if the event should be processed by this router. Routers can be
selectively invoked by configuing a filter on them. Usually the filter is
applied to the event when calling this method. All core Mule inbound routers
extend the SelectiveConsumer router.
- Specified by:
isMatch
in interface InboundRouter
- Overrides:
isMatch
in class SelectiveConsumer
- Parameters:
event
- the current event to evaluate
- Returns:
- true if the event should be processed by this router
- Throws:
MessagingException
- if the event cannot be evaluated- See Also:
SelectiveConsumer
process
public MuleEvent[] process(MuleEvent event)
throws MessagingException
- Description copied from interface:
InboundRouter
- A received MuleEvent is passed to this method for processing. The router can
control processing by either 1. passing back a null to indicate that the
router has either discarded the event of the event has been stored for further
processing. A reaosn for storing the event might be that other events in it's
correlation group are expected to be received. 2. Pass back an array of one or
more events to be processed by the service. Often 1 event is returned, i.e.
in the case of event aggregation. The router may return an array of events if
a set of events have been resequenced or multiple events have been generated
from a single event.
- Specified by:
process
in interface InboundRouter
- Overrides:
process
in class SelectiveConsumer
- Parameters:
event
- the event received by the inbound endpoint before it is passed to
the service
- Returns:
- null to indicate the event has been stored/destroyed or an array of
events to be processed by the service
- Throws:
MessagingException
- if an error occurs during processing of the event
getIdForEvent
protected Object getIdForEvent(MuleEvent event)
throws MessagingException
- Throws:
MessagingException
Copyright © 2003-2008 MuleSource, Inc.. All Rights Reserved.