T - The type of the MessageMonitor created for every payload type.Must implement both MessageMonitor
and MetricSetpublic class PayloadTypeMessageMonitorWrapper<T extends MessageMonitor<Message<?>> & com.codahale.metrics.MetricSet> extends Object implements MessageMonitor<Message<?>>, com.codahale.metrics.MetricSet
MessageMonitor implementation which creates a new MessageMonitor for every Message payload type
ingested by it. The PayloadTypeMessageMonitorWrapper keeps track of all distinct payload types it has created
and only creates a new one if there is none present.
The type of MessageMonitor which is created for every payload type is configurable, as long as it implements
MessageMonitor and MetricSet.
MessageMonitor.MonitorCallback| Constructor and Description |
|---|
PayloadTypeMessageMonitorWrapper(Supplier<T> monitorSupplier)
Create a PayloadTypeMessageMonitorWrapper which builds monitors through a given
monitorSupplier for
every message payload type encountered. |
PayloadTypeMessageMonitorWrapper(Supplier<T> monitorSupplier,
Function<Class<?>,String> monitorNameBuilder)
Create a PayloadTypeMessageMonitorWrapper which builds monitors through a given
monitorSupplier for
every message payload type encountered and sets the monitor name as specified by the monitorNameBuilder. |
| Modifier and Type | Method and Description |
|---|---|
Map<String,com.codahale.metrics.Metric> |
getMetrics() |
MessageMonitor.MonitorCallback |
onMessageIngested(Message<?> message)
Takes a message and returns a callback that should be used to inform the message monitor about the result of
processing the message
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonMessagesIngestedpublic PayloadTypeMessageMonitorWrapper(Supplier<T> monitorSupplier)
monitorSupplier for
every message payload type encountered.monitorSupplier - A Supplier of MessageMonitors of type T for every encountered payload typepublic PayloadTypeMessageMonitorWrapper(Supplier<T> monitorSupplier, Function<Class<?>,String> monitorNameBuilder)
monitorSupplier for
every message payload type encountered and sets the monitor name as specified by the monitorNameBuilder.monitorSupplier - A Supplier of MessageMonitors of type T for every encountered payload typemonitorNameBuilder - A Function where the payload type is the input (of type Class<?>) and output
is the desired name for the monitor (of type String)public MessageMonitor.MonitorCallback onMessageIngested(@Nonnull Message<?> message)
MessageMonitoronMessageIngested in interface MessageMonitor<Message<?>>message - the message to monitorCopyright © 2010–2023. All rights reserved.