Open tsurdilo opened 1 year ago
For client app use case sometimes we need to create additional WorkflowClient beans
May need multiple clients for for worker apps too not just client apps.
This is similar to #1799 but more generic. There was internal discussion with myself and @Quinn-With-Two-Ns about how to possibly support multiple clients on multiple workers.
annotate the default WorkflowClient bean with @primary in order to allow autowiring the default one without having to use Qualifier directly everywhere in your code.
Concur on @Primary
for the default, though we might need @Qualifier
to support multiple clients on multiple workers, but maybe that's a separate issue.
FWIW, this would work so @Qualifier
is unnecessary; perhaps already known:
@Autowired
WorkflowClient temporalWorkflowClient; // property named after the bean name
Springboot autoconfig defines the primary WorkflowClient bean thats generated from config as:
For client app use case sometimes we need to create additional WorkflowClient beans (for example one for a different namespace thats part of the use case). Its not possible to do this via config so to do this currently once a custom WorkflowClient bean is created, for example:
There are two issues with this:
Once you define this you no longer can resolve autowiring default WorkflowClient generated from config unless you use its name Qualifier, for example you have to do:
I think it would help if we annotate the default WorkflowClient bean with @Primary in order to allow autowiring the default one without having to use Qualifier directly everywhere in your code. Another idea could be to allow config of multiple clients from config directly, but not sure this is best approach maybe.
Wdyt?