Class CapacityMonitor
java.lang.Object
org.axonframework.extension.metrics.dropwizard.CapacityMonitor
- All Implemented Interfaces:
com.codahale.metrics.Metric,com.codahale.metrics.MetricSet,MessageMonitor<Message>
public class CapacityMonitor
extends Object
implements MessageMonitor<Message>, com.codahale.metrics.MetricSet
Calculates capacity by tracking, within the configured time window, the average message processing time
and multiplying that by the amount of messages processed.
The capacity can be more than 1 if the monitored
message handler processes the messages in parallel. The capacity for a single threaded message handler will be
a value between 0 and 1.
If the value for a single threaded message handler is 1 the component is active 100% of the time. This means
that messages will have to wait to be processed.
- Since:
- 3.0
- Author:
- Marijn van Zelst
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.axonframework.messaging.monitoring.MessageMonitor
MessageMonitor.MonitorCallback -
Constructor Summary
ConstructorsConstructorDescriptionCreates a capacity monitor with the default time window 10 minutesCapacityMonitor(long window, TimeUnit timeUnit) Creates a capacity monitor with the default time window 10 minutesCapacityMonitor(long window, TimeUnit timeUnit, com.codahale.metrics.Clock clock) Creates a capacity monitor with the given time window. -
Method Summary
Modifier and TypeMethodDescriptiononMessageIngested(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
-
CapacityMonitor
public CapacityMonitor()Creates a capacity monitor with the default time window 10 minutes -
CapacityMonitor
Creates a capacity monitor with the default time window 10 minutes- Parameters:
window- The length of the window to measure the capacity overtimeUnit- The time unit of the time window
-
CapacityMonitor
Creates a capacity monitor with the given time window. Uses the provided clock to measure process time per message.- Parameters:
window- The length of the window to measure the capacity overtimeUnit- The time unit of the time windowclock- The clock used to measure the process time per message
-
-
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<Message>- Parameters:
message- the message to monitor- Returns:
- the callback
-
getMetrics
- Specified by:
getMetricsin interfacecom.codahale.metrics.MetricSet
-