Interface ErrorGateway
- All Superinterfaces:
HasLocalHandlers, Namespaced<ErrorGateway>
- All Known Implementing Classes:
DefaultErrorGateway
The ErrorGateway is responsible for publishing error messages that occur during the processing of
commands, queries, schedules, web requests, or other types of messages. These error messages are typically
forwarded to a centralized error stream, which may be consumed for diagnostics, alerting, auditing, or automated
handling.
This interface provides methods to report errors as plain objects or as Message instances, along with
optional Metadata and a Guarantee that controls the dispatching behavior (e.g. SENT vs STORED).
Automatic Error Reporting
Fluxzero automatically reports exceptions that are thrown during handler method invocation. This includes bothRuntimeExceptions and checked exceptions wrapped in runtime exceptions. In most cases, users do not
need to manually report errors using this gateway.
Fluxzero can also integrate with popular logging frameworks (e.g. Logback, Log4j, SLF4J) to monitor and report any
logged warnings or errors as ERROR messages, depending on configuration. This provides deep visibility
into both application logic failures and operational anomalies.
Manual Use Cases
Manual usage of this gateway is only necessary in edge cases such as:- Forwarding functional errors from external systems that are not raised as exceptions.
- Publishing structured error messages for use in dashboards, alerting systems, or external consumers.
- Custom pipelines where message handling does not involve regular handler mechanisms.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidReports an error using the provided object.default voidReports an error with the given payload and metadata using the defaultGuarantee.NONE.Reports an error with the given payload, metadata, and delivery guarantee.Methods inherited from interface HasLocalHandlers
hasLocalHandlers, registerHandler, registerHandler, setSelfHandlerFilterMethods inherited from interface Namespaced
forDefaultNamespace, forNamespace
-
Method Details
-
report
-
report
Reports an error with the given payload and metadata using the defaultGuarantee.NONE.This method blocks until the reporting operation is completed or fails.
- Parameters:
payload- the error payloadmetadata- context metadata for the error
-
report
Reports an error with the given payload, metadata, and delivery guarantee.Returns a future that completes once the error message is sent or stored based on the provided guarantee.
- Parameters:
payload- the error payloadmetadata- metadata describing the context of the errorguarantee- whether to ensure message is sent (Guarantee.SENT) or stored (Guarantee.STORED)- Returns:
- a future that completes once the message has been handled appropriately
-