T - The type of the MessageMonitor created for every payload type.Must implement both MessageMonitor
and MetricSetpublic class PayloadTypeMessageMonitorWrapper<T extends org.axonframework.monitoring.MessageMonitor<org.axonframework.messaging.Message<?>> & com.codahale.metrics.MetricSet> extends Object implements org.axonframework.monitoring.MessageMonitor<org.axonframework.messaging.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.
| 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() |
org.axonframework.monitoring.MessageMonitor.MonitorCallback |
onMessageIngested(org.axonframework.messaging.Message<?> message) |
public 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 org.axonframework.monitoring.MessageMonitor.MonitorCallback onMessageIngested(@Nonnull org.axonframework.messaging.Message<?> message)
onMessageIngested in interface org.axonframework.monitoring.MessageMonitor<org.axonframework.messaging.Message<?>>Copyright © 2010–2023. All rights reserved.