Running a workflow with a variable number of activities

Hi y’all,

Is there a way to run a workflow which runs a variable number of activities depending on the outcome of previous activities? For example the workflow function would be:

activity1Output = runActivity1();
if (activity1Output) {
  runActivity2();
}else {
  //exit the workflow successfully 
}

Hi Sherif!

Yes, you can run an Activity based on the result of another Activity.
Here’s a sample you can take a look at: samples-java/HelloActivityExclusiveChoice.java at main · temporalio/samples-java · GitHub

1 Like