Hi all,
I have the following code snippet:
activity1.function1();
Workflow.await(() -> ...); // The workflow waits until a signal is received
activity2.function2();
I triggers a workflow, let’s call it workflow1
.
workflow1
is waiting for the signal.
Now, I want to exclude activity2
for all the workflows triggered in future.
I do the following:
activity1.function1();
Workflow.await(() -> ...);
int version = Workflow.getVersion("excludeActivity2", Workflow.DEFAULT_VERSION, 1);
if (version == 1) {
log.info("Activity 2 excluded.");
} else {
activity2.function2();
}
After re-running my application, I triggers another workflow, let’s call it workflow2
.
workflow2
is also waiting for the signal.
Then I send signals to both workflow1
and workflow2
.
But both workflow1
and workflow2
executes the if part, i.e., “Activity 2 excluded.” is printed.
Am I missing something while versioning?
How can I make sure only workflow1
executes activity2.function2();
?
Temporal version used is 1.23.2
Thanks,
Joe