org.mule.routing.inbound
Class IdempotentReceiver

java.lang.Object
  extended byorg.mule.routing.AbstractRouter
      extended byorg.mule.routing.inbound.SelectiveConsumer
          extended byorg.mule.routing.inbound.IdempotentReceiver
All Implemented Interfaces:
UMOInboundRouter, UMORouter
Direct Known Subclasses:
IdempotentSecureHashReceiver

public class IdempotentReceiver
extends SelectiveConsumer

IdempotentReceiver ensures that only unique messages are received by a component. 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. This implementation is simple and not suitable in a failover environment, this is because previously received message Ids are stored in memory and not persisted.


Field Summary
 
Fields inherited from class org.mule.routing.inbound.SelectiveConsumer
logger
 
Constructor Summary
IdempotentReceiver()
           
 
Method Summary
protected  Object getIdForEvent(UMOEvent event)
           
 String getStorePath()
           
 boolean isDisablePersistence()
           
 boolean isMatch(UMOEvent event)
          Determines if the event should be processed by this router.
protected  void load(UMOEvent event)
           
 UMOEvent[] process(UMOEvent event)
          A received UMOEvent is passed to this method for processing.
 void setDisablePersistence(boolean disablePersistence)
           
 void setStorePath(String storePath)
           
protected  void storeId(Object id)
           
 
Methods inherited from class org.mule.routing.inbound.SelectiveConsumer
getFilter, isTransformFirst, setFilter, setTransformFirst
 
Methods inherited from class org.mule.routing.AbstractRouter
getRouterStatistics, setRouterStatistics
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mule.umo.routing.UMORouter
getRouterStatistics, setRouterStatistics
 

Constructor Detail

IdempotentReceiver

public IdempotentReceiver()
Method Detail

isMatch

public boolean isMatch(UMOEvent event)
                throws MessagingException
Description copied from interface: UMOInboundRouter
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 UMOInboundRouter
Overrides:
isMatch in class SelectiveConsumer
Throws:
MessagingException

process

public UMOEvent[] process(UMOEvent event)
                   throws MessagingException
Description copied from interface: UMOInboundRouter
A received UMOEvent 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 component. 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 UMOInboundRouter
Overrides:
process in class SelectiveConsumer
Throws:
MessagingException

getIdForEvent

protected Object getIdForEvent(UMOEvent event)
                        throws MessagingException
Throws:
MessagingException

load

protected void load(UMOEvent event)
             throws RoutingException
Throws:
RoutingException

storeId

protected void storeId(Object id)
                throws IOException
Throws:
IOException

isDisablePersistence

public boolean isDisablePersistence()

setDisablePersistence

public void setDisablePersistence(boolean disablePersistence)

getStorePath

public String getStorePath()

setStorePath

public void setStorePath(String storePath)


Copyright © 2003-2008 MuleSource, Inc.. All Rights Reserved.