Interface CommandObserver
- All Known Implementing Classes:
LoggingCommandObserver
By registering a CommandObserver
with a DataApiClient
, clients can extend the client's functionality
in a decoupled manner, enabling custom behaviors such as logging command details, pushing metrics to a monitoring system,
or even triggering additional business logic based on the command's execution.
This interface is particularly useful in scenarios where actions need to be taken immediately after a command's execution,
and where those actions might depend on the outcome or metadata of the command. Implementers can receive detailed
information about the command's execution through the ExecutionInfos
parameter, allowing for rich and context-aware processing.
- Logging command execution details for audit or debugging purposes.
- Collecting performance metrics of command executions to monitor the health and performance of the application.
- Triggering additional processes or workflows based on the success or failure of a command.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onCommand
(ExecutionInfos executionInfo) Invoked when a command is executed, providing an opportunity for registered observers to perform synchronous post-execution treatments based on the command's execution information.
-
Method Details
-
onCommand
Invoked when a command is executed, providing an opportunity for registered observers to perform synchronous post-execution treatments based on the command's execution information.Implementers should define the logic within this method to handle the command execution event, utilizing the
ExecutionInfos
provided to access details about the command's execution context, results, and status. This method is called synchronously, ensuring that any processing here is completed before the command execution flow continues.- Parameters:
executionInfo
- TheExecutionInfos
containing detailed information about the executed command, including execution context, results, and any errors or warnings that occurred.
-