Interface Command


  • public interface Command
    Executor's Command are dedicated to contain purely business logic that should be executed. It should not have any reference to underlying process engine and should not be concerned with any process runtime related logic such us completing work item, sending signals, etc.
    Information that are taken from process will be delivered as part of data instance of CommandContext. Depending on the execution context that data can vary but in most of the cases following will be given:
    • businessKey - usually unique identifier of the caller
    • callbacks - FQCN of the CommandCollback that shall be used on command completion
    When executed as part of the process (work item handler) additional data can be expected:
    • workItem - the actual work item that is being executed with all it's parameters
    • processInstanceId - id of the process instance that triggered this work
    • deploymentId - if given process instance is part of an active deployment
    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

      • execute

        ExecutionResults execute​(CommandContext ctx)
                          throws Exception
        Executed this command's logic.
        Parameters:
        ctx - - contextual data given by the executor service
        Returns:
        returns any results in case of successful execution
        Throws:
        Exception - in case execution failed and shall be retried if possible