Reputation: 199
I have a SWF workflow decider to which I need to pass a set of values. I already have a class (POJO) which has all these as instance variables. So should I pass the POJO as input parameter or pass the individual fields.
@Workflow
@@WorkflowRegistrationOptions(....)
public interface WorkerClass {
@Execute(version = "1.0")
void generate(String a, int b, List<String> c, String d);
}
or
void generate(POJO pojo);
where POJO is
class POJO {
private String a;
private int b;
private List<String> c;
private String d;
//Getter and setters
}
Which is best?
P.S : I need to run this from SWF console
Upvotes: 3
Views: 1129
Reputation: 6870
As a general design pattern I prefer passing POJO for initialization as adding fields to it is backwards compatible. AWS Flow Framework supports both approaches. By default it uses JsonDataConverter to serialize function parameters. You can always write your own that parses workflow input string field into your POJO structure (and specifying it at @Workflow annotation) or specify parameters in the way that JSON converter expects. The easiest way to learn about the default format is to start workflow using generated external client and then look at the input field from the workflow WorkflowExecutionStartedEvent.
Upvotes: 1