public class CapacityMonitor extends Object implements MessageMonitor<Message<?>>
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.
MessageMonitor.MonitorCallback
Modifier and Type | Method and Description |
---|---|
static CapacityMonitor |
buildMonitor(String meterNamePrefix,
io.micrometer.core.instrument.MeterRegistry meterRegistry)
Creates a capacity monitor with the default time window 10 minutes
|
static CapacityMonitor |
buildMonitor(String meterNamePrefix,
io.micrometer.core.instrument.MeterRegistry meterRegistry,
Function<Message<?>,Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder)
Creates a capacity monitor with the default time window 10 minutes
|
static CapacityMonitor |
buildMonitor(String meterNamePrefix,
io.micrometer.core.instrument.MeterRegistry meterRegistry,
long window,
TimeUnit timeUnit)
Creates a capacity monitor with the default system clock.
|
static CapacityMonitor |
buildMonitor(String meterNamePrefix,
io.micrometer.core.instrument.MeterRegistry meterRegistry,
long window,
TimeUnit timeUnit,
io.micrometer.core.instrument.Clock clock)
Creates a capacity monitor with the given time window.
|
static CapacityMonitor |
buildMonitor(String meterNamePrefix,
io.micrometer.core.instrument.MeterRegistry meterRegistry,
long window,
TimeUnit timeUnit,
io.micrometer.core.instrument.Clock clock,
Function<Message<?>,Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder)
Creates a capacity monitor with the given time window.
|
static CapacityMonitor |
buildMonitor(String meterNamePrefix,
io.micrometer.core.instrument.MeterRegistry meterRegistry,
long window,
TimeUnit timeUnit,
Function<Message<?>,Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder)
Creates a capacity monitor with the default system clock.
|
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, wait
onMessagesIngested
public static CapacityMonitor buildMonitor(String meterNamePrefix, io.micrometer.core.instrument.MeterRegistry meterRegistry)
meterNamePrefix
- The prefix for the meter name that will be created in the given meterRegistrymeterRegistry
- The meter registry used to create and register the meterspublic static CapacityMonitor buildMonitor(String meterNamePrefix, io.micrometer.core.instrument.MeterRegistry meterRegistry, Function<Message<?>,Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder)
meterNamePrefix
- The prefix for the meter name that will be created in the given meterRegistrymeterRegistry
- The meter registry used to create and register the meterstagsBuilder
- The function used to construct the list of micrometer Tag
, based on the ingested
messagepublic static CapacityMonitor buildMonitor(String meterNamePrefix, io.micrometer.core.instrument.MeterRegistry meterRegistry, long window, TimeUnit timeUnit)
meterNamePrefix
- The prefix for the meter name that will be created in the given meterRegistrymeterRegistry
- The meter registry used to create and register the meterswindow
- The length of the window to measure the capacity overtimeUnit
- The temporal unit of the time windowpublic static CapacityMonitor buildMonitor(String meterNamePrefix, io.micrometer.core.instrument.MeterRegistry meterRegistry, long window, TimeUnit timeUnit, Function<Message<?>,Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder)
meterNamePrefix
- The prefix for the meter name that will be created in the given meterRegistrymeterRegistry
- The meter registry used to create and register the meterswindow
- The length of the window to measure the capacity overtimeUnit
- The temporal unit of the time windowtagsBuilder
- The function used to construct the list of micrometer Tag
, based on the ingested
messagepublic static CapacityMonitor buildMonitor(String meterNamePrefix, io.micrometer.core.instrument.MeterRegistry meterRegistry, long window, TimeUnit timeUnit, io.micrometer.core.instrument.Clock clock)
meterNamePrefix
- The prefix for the meter name that will be created in the given meterRegistrymeterRegistry
- The meter registry used to create and register the meterswindow
- The length of the window to measure the capacity overtimeUnit
- The temporal unit of the time windowclock
- The clock used to measure the process time per messagepublic static CapacityMonitor buildMonitor(String meterNamePrefix, io.micrometer.core.instrument.MeterRegistry meterRegistry, long window, TimeUnit timeUnit, io.micrometer.core.instrument.Clock clock, Function<Message<?>,Iterable<io.micrometer.core.instrument.Tag>> tagsBuilder)
meterNamePrefix
- The prefix for the meter name that will be created in the given meterRegistrymeterRegistry
- The meter registry used to create and register the meterswindow
- The length of the window to measure the capacity overtimeUnit
- The temporal unit of the time windowclock
- The clock used to measure the process time per messagetagsBuilder
- The function used to construct the list of micrometer Tag
, based on the ingested
messagepublic MessageMonitor.MonitorCallback onMessageIngested(Message<?> message)
MessageMonitor
onMessageIngested
in interface MessageMonitor<Message<?>>
message
- the message to monitorCopyright © 2010–2020. All rights reserved.