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.

@FunctionalInterface public interface ClientDispatchMonitor
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 Type
    Method
    Description
    void
    accept(MessageType messageType, String topic, List<SerializedMessage> messages)
    Called when a batch of messages is dispatched by the client.
  • Method Details

    • accept

      void accept(MessageType messageType, String topic, List<SerializedMessage> messages)
      Called when a batch of messages is dispatched by the client.
      Parameters:
      messageType - the type of the dispatched messages
      topic - the topic they were dispatched to, or null if not applicable
      messages - the messages that were dispatched