WorkflowTerminate (temporal_sdk_samples v0.2.0)

View Source

Terminate workflow execution command sample.

This sample demonstrates the use of the TemporalSdk.terminate_workflow/3 Temporal command. The sample attaches the telemetry event logger defined in the :workflow_eviction module. When the termination command is executed, SDK evicts workflow execution, and the workflow executor's :closing_state is set to {:external_evict, :terminated}.

Example run:

Elixir

iex(1)> WorkflowTerminate.run()
[temporal_sdk,workflow,executor,stop]: 3 -> {external_evict,terminated}
{:terminated,
 %{
   reason: "test termination",
   identity: "wkst/nonode@nohost/cluster_1/<0.997.0>"
 }}

Sample source: lib/workflow_terminate

Erlang

1> workflow_terminate:run().
[temporal_sdk,workflow,executor,stop]: 3 -> {external_evict,terminated}
{terminated,#{reason => <<"test termination">>,
              identity => <<"wkst/nonode@nohost/cluster_1/<0.359.0>">>}}

Sample source: src/workflow_terminate

Summary

Functions

run()