Interface ClientDispatchMonitor
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Functional interface for monitoring the dispatch of messages by a
Client
.
Implementations of this interface can be registered via
Client.monitorDispatch(ClientDispatchMonitor, MessageType...)
to observe when a batch of messages is
dispatched to a specific message gateway. This is useful for debugging, logging, metrics collection, or integration
testing.
Note that monitors are invoked synchronously during dispatch and should return quickly to avoid delaying message handling.
Example
client.monitorDispatch((type, topic, messages) -> {
System.out.printf("Dispatched %d %s message(s) to topic %s%n",
messages.size(), type, topic);
}, MessageType.COMMAND, MessageType.EVENT);
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(MessageType messageType, String topic, List<SerializedMessage> messages) Called when a batch of messages is dispatched by the client.
-
Method Details
-
accept
Called when a batch of messages is dispatched by the client.- Parameters:
messageType
- the type of the dispatched messagestopic
- the topic they were dispatched to, ornull
if not applicablemessages
- the messages that were dispatched
-