Cain v0.3.3 Worker View Source

Link to this section Summary

Functions

Creates a valid incident result. Add a error_msg with a max of 666 characters to indicate the reason of the failure and error_details for a detailed error description.

Invokes a scheduled retry cycle. Add a error_msg with a max of 666 characters to indicate the reason of the failure and details for a detailed error description. A number of retries must be >= 0 to indiciate of how often the task should be retried. The retry_timeout in milliseconds defines a limit before the external task becomes available again for fetching. Must be >= 0.

Creates a valid success result. Accepts an map with atom as keys for adding process variables. Local variables are not supported yet.

Throws a business error in the context of a running external task by id. The error_code must be specified to identify the BPMN error handler with a error_msg with a max of 666 characters that describes the error. Accepts an map with atom as keys for adding process variables.

Updates following worker attributes at runtime.

Link to this section Functions

Link to this function

create_incident(error_msg, error_details \\ "")

View Source

Specs

create_incident(String.t(), String.t()) ::
  {:incident, String.t(), String.t(), non_neg_integer(), pos_integer()}

Creates a valid incident result. Add a error_msg with a max of 666 characters to indicate the reason of the failure and error_details for a detailed error description.

Callback implementation for Cain.ExternalWorker.register_topics/0.

Link to this function

retry(error_msg, error_details \\ "", retries \\ 2, retry_timeout \\ 3000)

View Source

Specs

retry(String.t(), String.t(), pos_integer(), pos_integer()) ::
  {:incident, String.t(), String.t(), pos_integer(), pos_integer()}

Invokes a scheduled retry cycle. Add a error_msg with a max of 666 characters to indicate the reason of the failure and details for a detailed error description. A number of retries must be >= 0 to indiciate of how often the task should be retried. The retry_timeout in milliseconds defines a limit before the external task becomes available again for fetching. Must be >= 0.

Link to this function

success(variables \\ %{})

View Source

Specs

success(%{optional(atom()) => any()}) :: {:ok, map()}

Creates a valid success result. Accepts an map with atom as keys for adding process variables. Local variables are not supported yet.

Link to this function

throw_bpmn_error(error_code, error_msg, variables \\ %{})

View Source

Specs

throw_bpmn_error(String.t(), String.t(), map()) ::
  {:bpmn_error, String.t(), String.t(), map()}

Throws a business error in the context of a running external task by id. The error_code must be specified to identify the BPMN error handler with a error_msg with a max of 666 characters that describes the error. Accepts an map with atom as keys for adding process variables.

Specs

update(keyword()) :: :ok

Updates following worker attributes at runtime.

  • max_tasks to return on a fetch and lock call.
  • use_priority indicates whether the task should be fetched based on its priority or arbitrarily.
  • polling_interval in milliseconds, max: 1.800.000ms.