Interface Monitored<T>

Type Parameters:
T - the type of value being monitored (e.g., a List<SerializedMessage>)
All Known Subinterfaces:
GatewayClient, MessageStore
All Known Implementing Classes:
Backlog, CollectionMessageStore, InMemoryEventStore, InMemoryMessageStore, InMemoryScheduleStore, LocalEventStoreClient, LocalSchedulingClient, LocalTrackingClient, TestServerScheduleStore, WebsocketGatewayClient

public interface Monitored<T>
Represents a resource or component that can be monitored.

This interface provides a mechanism to observe activity or values of type T emitted or processed by the implementing component. It is often used to monitor outgoing messages from gateways, lifecycle events, or diagnostic metrics.

Example usage


 Monitored<Message> monitoredGateway = ...;
 Registration registration = monitoredGateway.registerMonitor(message -> {
     log.info("Published message: {}", message);
 });

 // Later, if needed
 registration.cancel(); // Stops monitoring
 
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Registers a monitor that will be notified when an activity of type T occurs.
  • Method Details

    • registerMonitor

      Registration registerMonitor(Consumer<T> monitor)
      Registers a monitor that will be notified when an activity of type T occurs.
      Parameters:
      monitor - the callback to invoke with each observed value
      Returns:
      a Registration that can be used to cancel the monitoring