Class MetadataTotalsInterceptor
- java.lang.Object
-
- com.adaptris.core.interceptor.WorkflowInterceptorImpl
-
- com.adaptris.core.interceptor.MetricsInterceptorImpl<MetadataStatistic>
-
- com.adaptris.core.interceptor.MetadataMetricsInterceptorImpl
-
- com.adaptris.core.interceptor.MetadataTotalsInterceptor
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,StateManagedComponent
,WorkflowInterceptor
@ComponentProfile(summary="Interceptor that adds the metadata value to an existing counter", tag="interceptor") public class MetadataTotalsInterceptor extends MetadataMetricsInterceptorImpl
WorkflowInterceptor implementation that exposes metrics about integer metadata values via JMX.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 getNumberFormatException
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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.adaptris.core.interceptor.MetricsInterceptorImpl
MetricsInterceptorImpl.StatisticsDelta<E extends InterceptorStatistic>
-
Nested classes/interfaces inherited from class com.adaptris.core.interceptor.WorkflowInterceptorImpl
WorkflowInterceptorImpl.WorkflowInterceptorException
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.interceptor.MetricsInterceptorImpl
DEFAULT_TIMESLICE_HISTORY_COUNT
-
Fields inherited from class com.adaptris.core.interceptor.WorkflowInterceptorImpl
log
-
-
Constructor Summary
Constructors Constructor Description MetadataTotalsInterceptor()
MetadataTotalsInterceptor(java.util.List<java.lang.String> keys)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.-
Methods inherited from class com.adaptris.core.interceptor.MetadataMetricsInterceptorImpl
clearStatistics, close, getStatisticManager, getStats, init, setStatisticManager, start, statisticManager, stop, update, updateCurrent
-
Methods inherited from class com.adaptris.core.interceptor.MetricsInterceptorImpl
getTimesliceDuration, getTimesliceHistoryCount, setTimesliceDuration, setTimesliceHistoryCount, timesliceHistoryCount
-
Methods inherited from class com.adaptris.core.interceptor.WorkflowInterceptorImpl
changeState, getUniqueId, parentChannel, parentWorkflow, prepare, registerParentChannel, registerParentWorkflow, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setUniqueId, wasSuccessful
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.WorkflowInterceptor
processingStart
-
-
-
-
Method Detail
-
workflowStart
public void workflowStart(AdaptrisMessage inputMsg)
Description copied from interface:WorkflowInterceptor
Mark the start of a workflow. This doesn't mean the message has started processing but only that the message will - at some point - be processed by the workflow.- Parameters:
inputMsg
- the message that will be processed by this workflow.
-
workflowEnd
public void workflowEnd(AdaptrisMessage inputMsg, AdaptrisMessage outputMsg)
Description copied from interface:WorkflowInterceptor
Mark the end of a workflow.- Parameters:
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.- See Also:
CoreConstants.OBJ_METADATA_EXCEPTION
-
getMetadataKeys
public java.util.List<java.lang.String> getMetadataKeys()
-
setMetadataKeys
public void setMetadataKeys(java.util.List<java.lang.String> l)
Set the list of metadata keys to track.- Parameters:
l
- the metadata keys.
-
-