So I created a signal method just print out the signal
@WorkflowInterface
public interface SignalWorkflow {
// The Workflow method is called by the initiator either via code or CLI.
@WorkflowMethod
void start();
@SignalMethod
void print(String str);
}
public static class SignalWorkflowImpl implements SignalWorkflow {
private int i = 0;
@Override
public void start() {
Workflow.sleep(Duration.ofHours(1));
}
@Override
public void print(String str) {
i++;
System.out.println("" + i + ": " + str);
}
}
I then send couple signals to the workflow:
tctl wf signal --workflow_id “dfcfc908-a3ba-4182-8e3f-caccaf378e2b” --name “print” --input “Hi1”
tctl wf signal --workflow_id “dfcfc908-a3ba-4182-8e3f-caccaf378e2b” --name “print” --input “Hi2”
tctl wf signal --workflow_id “dfcfc908-a3ba-4182-8e3f-caccaf378e2b” --name “print” --input “Hi3”
tctl wf signal --workflow_id “dfcfc908-a3ba-4182-8e3f-caccaf378e2b” --name “print” --input “Hi4”
And the output looks like this:
1: Hi1
1: Hi1
2: Hi2
1: Hi1
2: Hi2
3: Hi3
1: Hi1
2: Hi2
3: Hi3
4: Hi4
Every time I send a new signal, all previous signals got printed as well. Why is that?