Package io.fluxcapacitor.common
Interface Monitored<T>
- Type Parameters:
T
- the type of value being monitored (e.g., aList<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 TypeMethodDescriptionregisterMonitor
(Consumer<T> monitor) Registers a monitor that will be notified when an activity of typeT
occurs.
-
Method Details
-
registerMonitor
Registers a monitor that will be notified when an activity of typeT
occurs.- Parameters:
monitor
- the callback to invoke with each observed value- Returns:
- a
Registration
that can be used to cancel the monitoring
-