T
- The type of the MessageMonitor created for every payload type.Must implement both MessageMonitor
and MetricSet
public 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,
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
|
public 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(Message<?> message)
MessageMonitor
onMessageIngested
in interface MessageMonitor<Message<?>>
message
- the message to monitorCopyright © 2010–2017. All rights reserved.