I am writing a SWF Workflow Starter class in Java. The purpose of the class is to use a WorkflowClientExternalFactory to do a getClient() call, then use the WorkflowClientExternal to start my workflow. Here is the basic layout:
public class MyWorkflowStarter {
private final MyWorkflowClientExternalFactory factory;
public MyWorkflowStarter(MyWorkflowClientExternalFactory factory) {
this.factory = factory;
}
public void startyMyWorkflow (String input) {
final MyWorkflowClientExternal client = this.factory.getClient();
client.init(String input); // init() is a @Execute method in the workflow;
}
}
Now I have a list of Strings and I want to start a list of workflow, each workflow will take in a String to do its work.
My question is: does the startMyWorkflow-fn in MyWorkflowStarter class take in a list of String, and use a for-loop, each loop generate a client to call init fn; Or should I write a method in a new class, which will takes in a list String inputs, call MyWorkflowStarter a list of amount of times?
Any ideas on how to do this? Thanks a lot!
// Alternatively I could have a workflow and a list of activities, but I want the option of starting a list workflows.
From the SWF point of view it doesn't really matter. To start a workflow getClient() and client.init should be executed for each element of the list. But where this code lives is up to you.