@ComponentProfile(summary="Interceptor that increments a counter based on some metadata value", tag="interceptor") public class MetadataCountInterceptor extends MetadataMetricsInterceptorImpl
Each message that passes through the interceptor will be queried in turn for the configured key (getMetadataKey()
). The
string value associated with that key will be added to the existing total for that value within the given time period.
Effectively this interceptor counts the number of times a given metadata value is processed by the workflow within a given time
period.
In the adapter configuration file this class is aliased as metadata-count-interceptor which is the preferred alternative to the fully qualified classname when building your configuration.
MetricsInterceptorImpl.StatisticsDelta<E extends InterceptorStatistic>
WorkflowInterceptorImpl.WorkflowInterceptorException
DEFAULT_TIMESLICE_HISTORY_COUNT
log
Constructor and Description |
---|
MetadataCountInterceptor() |
MetadataCountInterceptor(java.lang.String key) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getMetadataKey() |
void |
init()
Initialises the component.
|
void |
setMetadataKey(java.lang.String key)
Set the metadata key whose values you wish to track.
|
void |
workflowEnd(AdaptrisMessage inputMsg,
AdaptrisMessage outputMsg)
Mark the end of a workflow.
|
void |
workflowStart(AdaptrisMessage inputMsg)
Mark the start of a workflow.
|
clearStatistics, close, getStatisticManager, getStats, setStatisticManager, start, statisticManager, stop, update, updateCurrent
getTimesliceDuration, getTimesliceHistoryCount, setTimesliceDuration, setTimesliceHistoryCount, timesliceHistoryCount
changeState, getUniqueId, parentChannel, parentWorkflow, prepare, registerParentChannel, registerParentWorkflow, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setUniqueId, wasSuccessful
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
processingStart
public MetadataCountInterceptor()
public MetadataCountInterceptor(java.lang.String key)
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
init
in interface ComponentLifecycle
init
in class MetadataMetricsInterceptorImpl
CoreException
- wrapping any underlying Exception
spublic void workflowStart(AdaptrisMessage inputMsg)
WorkflowInterceptor
inputMsg
- the message that will be processed by this workflow.public void workflowEnd(AdaptrisMessage inputMsg, AdaptrisMessage outputMsg)
WorkflowInterceptor
inputMsg
- the original message that was originally submitted to the workflow; in the event of an exception during
processing, the exception will be stored in object metadata in the inputMsgoutputMsg
- the message contaning any changes that may have been applied by the services within the workflow.CoreConstants.OBJ_METADATA_EXCEPTION
public java.lang.String getMetadataKey()
public void setMetadataKey(java.lang.String key)
key
- the metadata key.