workflow_terminate (temporal_sdk_samples v0.2.0)

View Source

Terminate workflow execution command sample.

This sample demonstrates the use of the temporal_sdk: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()

-spec run() -> temporal_sdk:workflow_result() | no_return().