Package com.adaptris.core.interceptor
Class MetadataCountInterceptor
- java.lang.Object
-
- com.adaptris.core.interceptor.WorkflowInterceptorImpl
-
- com.adaptris.core.interceptor.MetricsInterceptorImpl<MetadataStatistic>
-
- com.adaptris.core.interceptor.MetadataMetricsInterceptorImpl
-
- com.adaptris.core.interceptor.MetadataCountInterceptor
-
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,StateManagedComponent,WorkflowInterceptor
@ComponentProfile(summary="Interceptor that increments a counter based on some metadata value", tag="interceptor") public class MetadataCountInterceptor extends MetadataMetricsInterceptorImplWorkflowInterceptor implementation that exposes metrics about metadata values via JMX.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.
-
-
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 MetadataCountInterceptor()MetadataCountInterceptor(java.lang.String key)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetMetadataKey()voidinit()Initialises the component.voidsetMetadataKey(java.lang.String key)Set the metadata key whose values you wish to track.voidworkflowEnd(AdaptrisMessage inputMsg, AdaptrisMessage outputMsg)Mark the end of a workflow.voidworkflowStart(AdaptrisMessage inputMsg)Mark the start of a workflow.-
Methods inherited from class com.adaptris.core.interceptor.MetadataMetricsInterceptorImpl
clearStatistics, close, getStatisticManager, getStats, 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
-
init
public void init() throws CoreExceptionDescription copied from interface:ComponentLifecycleInitialises the component.Component initialisation includes config verification, creation of connections etc.
- Specified by:
initin interfaceComponentLifecycle- Overrides:
initin classMetadataMetricsInterceptorImpl- Throws:
CoreException- wrapping any underlyingExceptions
-
workflowStart
public void workflowStart(AdaptrisMessage inputMsg)
Description copied from interface:WorkflowInterceptorMark 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:WorkflowInterceptorMark 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
-
getMetadataKey
public java.lang.String getMetadataKey()
-
setMetadataKey
public void setMetadataKey(java.lang.String key)
Set the metadata key whose values you wish to track.- Parameters:
key- the metadata key.
-
-