Interface MetricsGateway
- All Superinterfaces:
HasLocalHandlers
- All Known Implementing Classes:
DefaultMetricsGateway
Gateway interface for publishing metrics messages in Flux Capacitor.
This gateway provides a convenient way to log and transmit application performance data, operational metrics, or
monitoring signals. Metrics messages can be published either as raw payloads or as fully constructed Message
objects. Metadata and delivery guarantees can also be specified.
Metrics are typically not routed for domain logic handling, but can be consumed by local handlers as well as non-local handlers (e.g., for logging or real-time telemetry).
Example usage:
FluxCapacitor.publishMetrics(new SystemMetrics(...));
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
Publishes a metrics message using default metadata andGuarantee.NONE
.default void
Publishes a metrics payload with the specified metadata and aGuarantee.NONE
delivery guarantee.Publishes a metrics message with the specified metadata and delivery guarantee.Methods inherited from interface io.fluxcapacitor.javaclient.tracking.handling.HasLocalHandlers
hasLocalHandlers, registerHandler, registerHandler, setSelfHandlerFilter
-
Method Details
-
publish
Publishes a metrics message using default metadata andGuarantee.NONE
.If the provided value is already a
Message
, its payload and metadata will be extracted. Otherwise, it is wrapped in a newMessage
.- Parameters:
metrics
- the metrics object orMessage
to publish
-
publish
Publishes a metrics payload with the specified metadata and aGuarantee.NONE
delivery guarantee.- Parameters:
payload
- the payload of the metrics messagemetadata
- metadata to attach to the message
-
publish
Publishes a metrics message with the specified metadata and delivery guarantee.This method may complete asynchronously.
- Parameters:
payload
- the metrics payloadmetadata
- metadata to attach to the messageguarantee
- delivery guarantee (e.g.,Guarantee.SENT
orGuarantee.STORED
)- Returns:
- a
CompletableFuture
that completes when the message is published (or not, depending on the guarantee)
-