Interface CommandCallback


  • public interface CommandCallback
    CommandCallback represents logic that shall be executed after command invocation. Depending on the result of invocation either onCommandDone or onCommandError will be called.
    Important note about implementations is that it shall always be possible to be initialized with default constructor as executor service is an async component so it will initialize the command on demand using reflection. In case there is a heavy logic on initialization it should be placed in another service implementation that can be looked up from within command.
    • Method Detail

      • onCommandDone

        void onCommandDone​(CommandContext ctx,
                           ExecutionResults results)
        Executed as soon as command is executed successfully.
        Parameters:
        ctx - - contextual data given by the executor service
        results - - result produced by command
      • onCommandError

        void onCommandError​(CommandContext ctx,
                            Throwable exception)
        Executed only when command failed and all possible retries were already invoked. This indicates that executor will not attempt any more execution of given command as part of the request.
        Parameters:
        ctx - - contextual data given by the executor service
        exception - - exception that was thrown on last attempt to execute command