@ComponentProfile(summary="Interceptor that adds the metadata value to an existing counter", tag="interceptor") public class MetadataTotalsInterceptor extends MetadataMetricsInterceptorImpl
Each message that passes through the interceptor will be queried in turn for each configured key (getMetadataKeys()
).
The integer value associated with that key will be added to the existing total for that key within the given time period.
The general use-case is when you capture a count of some description (e.g. number of lines), store it against metadata, and to
keep a running total of that number for a given time interval. The counts are exposed via MetadataStatisticsMBean
for
capture and display. Note that if the metadata keys contain non-numeric values, then results are undefined (at the very least you
will get NumberFormatException
being thrown).
In the adapter configuration file this class is aliased as metadata-totals-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 |
---|
MetadataTotalsInterceptor() |
MetadataTotalsInterceptor(java.util.List<java.lang.String> keys) |
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
getMetadataKeys() |
void |
setMetadataKeys(java.util.List<java.lang.String> l)
Set the list of metadata keys 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, init, 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
public MetadataTotalsInterceptor()
public MetadataTotalsInterceptor(java.util.List<java.lang.String> keys)
public 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.util.List<java.lang.String> getMetadataKeys()
public void setMetadataKeys(java.util.List<java.lang.String> l)
l
- the metadata keys.