Class ExternalTaskServiceImpl

    • Constructor Detail

      • ExternalTaskServiceImpl

        public ExternalTaskServiceImpl​(EngineClient engineClient)
    • Method Detail

      • lock

        public void lock​(ExternalTask externalTask,
                         long lockDuration)
        Description copied from interface: ExternalTaskService
        Locks a task by a given amount of time. Note: This method should be used to lock external tasks that have been obtained without using the fetch & lock API.
        Specified by:
        lock in interface ExternalTaskService
        Parameters:
        externalTask - which lock will be extended
        lockDuration - specifies the lock duration in milliseconds
      • lock

        public void lock​(String externalTaskId,
                         long lockDuration)
        Description copied from interface: ExternalTaskService
        Locks a task by a given amount of time. Note: This method should be used to lock external tasks that have been obtained without using the fetch & lock API.
        Specified by:
        lock in interface ExternalTaskService
        Parameters:
        externalTaskId - the id of the external task whose lock will be extended
        lockDuration - specifies the lock duration in milliseconds
      • unlock

        public void unlock​(ExternalTask externalTask)
        Description copied from interface: ExternalTaskService
        Unlocks a task and clears the tasks lock expiration time and worker id.
        Specified by:
        unlock in interface ExternalTaskService
        Parameters:
        externalTask - which will be unlocked
      • setVariables

        public void setVariables​(String processInstanceId,
                                 Map<String,​Object> variables)
        Description copied from interface: ExternalTaskService
        Set variables
        Specified by:
        setVariables in interface ExternalTaskService
        variables - are set in the tasks ancestor execution hierarchy. The key and the value represent the variable name and its value. Map can consist of both typed and untyped variables.
      • setVariables

        public void setVariables​(ExternalTask externalTask,
                                 Map<String,​Object> variables)
        Description copied from interface: ExternalTaskService
        Set variables
        Specified by:
        setVariables in interface ExternalTaskService
        variables - are set in the tasks ancestor execution hierarchy. The key and the value represent the variable name and its value. Map can consist of both typed and untyped variables.
      • complete

        public void complete​(ExternalTask externalTask,
                             Map<String,​Object> variables)
        Description copied from interface: ExternalTaskService
        Completes a task.
        Specified by:
        complete in interface ExternalTaskService
        Parameters:
        externalTask - which will be completed
        variables - are set in the tasks ancestor execution hierarchy The key and the value represent the variable name and its value. Map can consist of both typed and untyped variables.
      • complete

        public void complete​(ExternalTask externalTask,
                             Map<String,​Object> variables,
                             Map<String,​Object> localVariables)
        Description copied from interface: ExternalTaskService
        Completes a task.
        Specified by:
        complete in interface ExternalTaskService
        Parameters:
        externalTask - which will be completed
        variables - are set in the tasks ancestor execution hierarchy. The key and the value represent the variable name and its value. Map can consist of both typed and untyped variables.
        localVariables - are set in the execution of the external task instance. The key and the value represent the variable name and its value. Map can consist of both typed and untyped variables.
      • complete

        public void complete​(String externalTaskId,
                             Map<String,​Object> variables,
                             Map<String,​Object> localVariables)
        Description copied from interface: ExternalTaskService
        Completes a task.
        Specified by:
        complete in interface ExternalTaskService
        Parameters:
        externalTaskId - the id of the external task which will be completed
        variables - are set in the tasks ancestor execution hierarchy. The key and the value represent the variable name and its value. Map can consist of both typed and untyped variables.
        localVariables - are set in the execution of the external task instance. The key and the value represent the variable name and its value. Map can consist of both typed and untyped variables.
      • handleFailure

        public void handleFailure​(ExternalTask externalTask,
                                  String errorMessage,
                                  String errorDetails,
                                  int retries,
                                  long retryTimeout)
        Description copied from interface: ExternalTaskService
        Reports a failure to execute a task. A number of retries and a timeout until the task can be specified. If the retries are set to 0, an incident for this task is created.
        Specified by:
        handleFailure in interface ExternalTaskService
        Parameters:
        externalTask - external task for which a failure will be reported
        errorMessage - indicates the reason of the failure.
        errorDetails - provides a detailed error description.
        retries - specifies how often the task should be retried. Must be >= 0. If 0, an incident is created and the task cannot be fetched anymore unless the retries are increased again. The incident's message is set to the errorMessage parameter.
        retryTimeout - specifies a timeout in milliseconds before the external task becomes available again for fetching. Must be >= 0.
      • handleFailure

        public void handleFailure​(String externalTaskId,
                                  String errorMessage,
                                  String errorDetails,
                                  int retries,
                                  long retryTimeout)
        Description copied from interface: ExternalTaskService
        Reports a failure to execute a task. A number of retries and a timeout until the task can be specified. If the retries are set to 0, an incident for this task is created.
        Specified by:
        handleFailure in interface ExternalTaskService
        Parameters:
        externalTaskId - the id of the external task for which a failure will be reported
        errorMessage - indicates the reason of the failure.
        errorDetails - provides a detailed error description.
        retries - specifies how often the task should be retried. Must be >= 0. If 0, an incident is created and the task cannot be fetched anymore unless the retries are increased again. The incident's message is set to the errorMessage parameter.
        retryTimeout - specifies a timeout in milliseconds before the external task becomes available again for fetching. Must be >= 0.
      • handleFailure

        public void handleFailure​(String externalTaskId,
                                  String errorMessage,
                                  String errorDetails,
                                  int retries,
                                  long retryTimeout,
                                  Map<String,​Object> variables,
                                  Map<String,​Object> locaclVariables)
        Description copied from interface: ExternalTaskService
        Reports a failure to execute a task. A number of retries and a timeout until the task can be specified. If the retries are set to 0, an incident for this task is created.
        Specified by:
        handleFailure in interface ExternalTaskService
        Parameters:
        externalTaskId - the id of the external task for which a failure will be reported
        errorMessage - indicates the reason of the failure.
        errorDetails - provides a detailed error description.
        retries - specifies how often the task should be retried. Must be >= 0. If 0, an incident is created and the task cannot be fetched anymore unless the retries are increased again. The incident's message is set to the errorMessage parameter.
        retryTimeout - specifies a timeout in milliseconds before the external task becomes available again for fetching. Must be >= 0.
        variables - a map of variables to set on the execution the external task is assigned to
        locaclVariables - a map of variables to set on the execution locally
      • handleBpmnError

        public void handleBpmnError​(ExternalTask externalTask,
                                    String errorCode)
        Description copied from interface: ExternalTaskService
        Reports a business error in the context of a running task. The error code must be specified to identify the BPMN error handler.
        Specified by:
        handleBpmnError in interface ExternalTaskService
        Parameters:
        externalTask - external task for which a BPMN error will be reported
        errorCode - that indicates the predefined error. The error code is used to identify the BPMN error handler.
      • handleBpmnError

        public void handleBpmnError​(ExternalTask externalTask,
                                    String errorCode,
                                    String errorMessage)
        Description copied from interface: ExternalTaskService
        Reports a business error in the context of a running task. The error code must be specified to identify the BPMN error handler.
        Specified by:
        handleBpmnError in interface ExternalTaskService
        Parameters:
        externalTask - external task for which a BPMN error will be reported
        errorCode - that indicates the predefined error. The error code is used to identify the BPMN error handler.
        errorMessage - which will be passed when the BPMN error is caught
      • handleBpmnError

        public void handleBpmnError​(ExternalTask externalTask,
                                    String errorCode,
                                    String errorMessage,
                                    Map<String,​Object> variables)
        Description copied from interface: ExternalTaskService
        Reports a business error in the context of a running task. The error code must be specified to identify the BPMN error handler.
        Specified by:
        handleBpmnError in interface ExternalTaskService
        Parameters:
        externalTask - external task for which a BPMN error will be reported
        errorCode - that indicates the predefined error. The error code is used to identify the BPMN error handler.
        errorMessage - which will be passed when the BPMN error is caught
        variables - which will be passed to the execution when the BPMN error is caught
      • handleBpmnError

        public void handleBpmnError​(String externalTaskId,
                                    String errorCode,
                                    String errorMessage,
                                    Map<String,​Object> variables)
        Description copied from interface: ExternalTaskService
        Reports a business error in the context of a running task. The error code must be specified to identify the BPMN error handler.
        Specified by:
        handleBpmnError in interface ExternalTaskService
        Parameters:
        externalTaskId - the id of the external task for which a BPMN error will be reported
        errorCode - that indicates the predefined error. The error code is used to identify the BPMN error handler.
        errorMessage - which will be passed when the BPMN error is caught
        variables - which will be passed to the execution when the BPMN error is caught
      • extendLock

        public void extendLock​(ExternalTask externalTask,
                               long newDuration)
        Description copied from interface: ExternalTaskService
        Extends the timeout of the lock by a given amount of time.
        Specified by:
        extendLock in interface ExternalTaskService
        Parameters:
        externalTask - which lock will be extended
        newDuration - specifies the the new lock duration in milliseconds
      • extendLock

        public void extendLock​(String externalTaskId,
                               long newDuration)
        Description copied from interface: ExternalTaskService
        Extends the timeout of the lock by a given amount of time.
        Specified by:
        extendLock in interface ExternalTaskService
        Parameters:
        externalTaskId - the id of the external task which lock will be extended
        newDuration - specifies the the new lock duration in milliseconds