tctl workflow signal
The tctl workflow signal
command Signals a Workflow Execution.
Workflows listen for Signals by their Signal name, and can be made to listen to one or more Signal names. The Workflow below listens for instances of "HelloSignal":
tctl workflow start --workflow_id "HelloSignal" --taskqueue HelloWorldTaskQueue --workflow_type HelloWorld --execution_timeout 3600 --input \"World\"
The Worker would return this output upon receiving the Signal:
13:57:44.258 [workflow-method] INFO c.t.s.javaquickstart.GettingStarted - 1: Hello World!
Signals can also be used to change variable values.
tctl workflow signal --workflow_id "HelloSignal" --name "updateGreeting" --input \"Hi\"
The output would change from the first Signal received.
13:57:44.258 [workflow-method] INFO c.t.s.javaquickstart.GettingStarted - 1: Hello World!
13:58:22.352 [workflow-method] INFO c.t.s.javaquickstart.GettingStarted - 2: Hi World!
When a Signal is sent, an await condition is made to block any Signals that contain the same input value. However, changing the greeting in our example unblocks it:
tctl workflow signal --workflow_id "HelloSignal" --name "updateGreeting" --input \"Welcome\"
Worker output:
13:57:44.258 [workflow-method] INFO c.t.s.javaquickstart.GettingStarted - 1: Hello World!
13:58:22.352 [workflow-method] INFO c.t.s.javaquickstart.GettingStarted - 2: Hi World!
13:59:29.097 [workflow-method] INFO c.t.s.javaquickstart.GettingStarted - 3: Welcome World!
Sending Signals does not require a running Worker.
tctl workflow signal --workflow_id "HelloSignal" --name "updateGreeting" --input \"Welcome\"
CLI output:
Signal workflow succeeded.
The Signal request is queued inside the Temporal Server until the Worker is restarted. If the given Signal contains the same input as before, the queued Signal will be ignored.
Complete the Workflow by sending a Signal with a "Bye" greeting:
tctl workflow signal --workflow_id "HelloSignal" --name "updateGreeting" --input \"Bye\"
Check that the Workflow Execution has been completed.
tctl workflow showid HelloSignal
Modifiers
Signals are written as follows:
tctl workflow signal --workflow_id [modifiers]
The following modifiers control the behavior of the command. Make sure to include required modifiers in all command executions.
--workflow_id
Specify a Workflow Id. This modifier is required.
Aliases: --wid
, -w
Example
tctl workflow signal --workflow_id <id>
--run_id
Specify a Run Id.
Aliases: --rid
, -r
Example
tctl workflow signal --run_id <id>
--name
Specify the name of a Signal.
Alias: -n
Example
tctl workflow signal --name <name>
--input
Pass input for the Signal. Input must be in JSON format.
Alias: -i
Example
tctl workflow signal --input <json>
--input_file
Pass input for the Signal from a JSON file.
Alias: --if
Example
tctl workflow signal --input_file <filename>