[Workflow] Workflow services should support configuration values
Although #2 describes a more general approach to configuration, it would also be nice to more directly support configuration values in workflow services as follows.
For example, we might wish to define a workflow service that takes a configuration value:
func NewNonLeafServiceImpl(leafService LeafService, myConfigValue string) (NonLeafService, error)
In the wiring spec, workflow services are instantiated with workflow.Define
. The arguments of workflow.Define
must name IRNodes to be used as arguments to the above constructor.
However, while #3 does suggest that we introduce an IRNode to represent configuration values, it should not be required by default for workflows, as it introduces verbosity into the wiring spec. In the simple case it would be nice to be able to directly provide configuration values in the call to wiring.Define
, e.g.
wiring.Define(workflow, "myservice", "NonLeafServiceImpl", "myleafservice", "myconfigvalue")
For the above to succeed, we will need to eagerly load the constructor definition of NonLeafServiceImpl
and look at the argument types to deduce that the "myleafservice" argument should correspond to an IRNode, whereas "myconfigvalue" is a basic type and thus should be inserted directly into the generated code.
The workflow IRNode will thus need to be updated to save those config values, and the code generation updated to insert the config values.