org.mule.transport.polling.watermark
Class Watermark

java.lang.Object
  extended by org.mule.transport.polling.MessageProcessorPollingOverride
      extended by org.mule.transport.polling.watermark.Watermark
Direct Known Subclasses:
SelectorWatermark, UpdateExpressionWatermark

public abstract class Watermark
extends MessageProcessorPollingOverride

Poll override that provides watermarking functionality: It enriches the event passed to the polling message processor to have a flow variable fetched from the object store defined, ensures the variable is carried over to the flow event if it is going to be executed, and saves the value of the variable back to the object store at the end of the flow.

A limitation of this implementation is that the poll must be embedded into a synchronous flow. An exception will be thrown if this is not the case.

Since:
3.5.0

Field Summary
protected  Map<QName,Object> annotations
          The watermark annotations added to the definition
 
Constructor Summary
Watermark(ObjectStore<Serializable> objectStore, String variable, String defaultExpression)
           
 
Method Summary
protected abstract  Object getUpdatedValue(MuleEvent event)
          This method is executed once the flow containing the poll has been executed.
 void putInto(MuleEvent event)
          Retrieves the watermark value from the underlying peristent store and enriches the event.If there is no value stored, a default expression will be used to create a new one.
protected  String resolveVariable(MuleEvent event)
           
 void updateFrom(MuleEvent event)
          Updates the watermark in persistent storage based on the flow variable defined in the event
 void updateWith(MuleEvent event, Serializable newValue)
           
 
Methods inherited from class org.mule.transport.polling.MessageProcessorPollingOverride
interceptor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

annotations

protected Map<QName,Object> annotations
The watermark annotations added to the definition

Constructor Detail

Watermark

public Watermark(ObjectStore<Serializable> objectStore,
                 String variable,
                 String defaultExpression)
Method Detail

resolveVariable

protected String resolveVariable(MuleEvent event)

putInto

public void putInto(MuleEvent event)
             throws ObjectStoreException
Retrieves the watermark value from the underlying peristent store and enriches the event.If there is no value stored, a default expression will be used to create a new one.

Throws:
ObjectStoreException

updateWith

public final void updateWith(MuleEvent event,
                             Serializable newValue)
                      throws ObjectStoreException
Throws:
ObjectStoreException

updateFrom

public final void updateFrom(MuleEvent event)
                      throws ObjectStoreException
Updates the watermark in persistent storage based on the flow variable defined in the event

Parameters:
event - The event containing the watermark as a flow variable
Throws:
ObjectStoreException

getUpdatedValue

protected abstract Object getUpdatedValue(MuleEvent event)
This method is executed once the flow containing the poll has been executed. This method must return the watermark's new value

Parameters:
event - the MuleEvent that was returned by the owning flow
Returns:
the new watermark value


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