Class PayloadTypeMessageMonitorWrapper<T extends MessageMonitor<Message> & io.dropwizard.metrics5.MetricSet>
java.lang.Object
org.axonframework.extension.metrics.dropwizard.PayloadTypeMessageMonitorWrapper<T>
- Type Parameters:
T- The type of the MessageMonitor created for every payload type.Must implement bothMessageMonitorandMetricSet
- All Implemented Interfaces:
io.dropwizard.metrics5.Metric,io.dropwizard.metrics5.MetricSet,MessageMonitor<Message>
public class PayloadTypeMessageMonitorWrapper<T extends MessageMonitor<Message> & io.dropwizard.metrics5.MetricSet>
extends Object
implements MessageMonitor<Message>, io.dropwizard.metrics5.MetricSet
A
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.
- Since:
- 3.0
- Author:
- Steven van Beelen
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.axonframework.messaging.monitoring.MessageMonitor
MessageMonitor.MonitorCallback -
Constructor Summary
ConstructorsConstructorDescriptionPayloadTypeMessageMonitorWrapper(Supplier<T> monitorSupplier) Create a PayloadTypeMessageMonitorWrapper which builds monitors through a givenmonitorSupplierfor every message payload type encountered.PayloadTypeMessageMonitorWrapper(Supplier<T> monitorSupplier, Function<Class<?>, String> monitorNameBuilder) Create a PayloadTypeMessageMonitorWrapper which builds monitors through a givenmonitorSupplierfor every message payload type encountered and sets the monitor name as specified by themonitorNameBuilder. -
Method Summary
Modifier and TypeMethodDescriptionMap<io.dropwizard.metrics5.MetricName, io.dropwizard.metrics5.Metric> 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 messageMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.messaging.monitoring.MessageMonitor
onMessagesIngested
-
Constructor Details
-
PayloadTypeMessageMonitorWrapper
Create a PayloadTypeMessageMonitorWrapper which builds monitors through a givenmonitorSupplierfor every message payload type encountered.- Parameters:
monitorSupplier- A Supplier of MessageMonitors of typeTfor every encountered payload type
-
PayloadTypeMessageMonitorWrapper
public PayloadTypeMessageMonitorWrapper(Supplier<T> monitorSupplier, Function<Class<?>, String> monitorNameBuilder) Create a PayloadTypeMessageMonitorWrapper which builds monitors through a givenmonitorSupplierfor every message payload type encountered and sets the monitor name as specified by themonitorNameBuilder.- Parameters:
monitorSupplier- A Supplier of MessageMonitors of typeTfor every encountered payload typemonitorNameBuilder- A Function where the payload type is the input (of typeClass<?>) and output is the desired name for the monitor (of typeString)
-
-
Method Details
-
onMessageIngested
Description copied from interface:MessageMonitorTakes a message and returns a callback that should be used to inform the message monitor about the result of processing the message- Specified by:
onMessageIngestedin interfaceMessageMonitor<T extends MessageMonitor<Message> & io.dropwizard.metrics5.MetricSet>- Parameters:
message- the message to monitor- Returns:
- the callback
-
getMetrics
- Specified by:
getMetricsin interfaceio.dropwizard.metrics5.MetricSet
-