infiniticio / infinitic

Infinitic is an open source orchestration framework for application teams to build durable and flexible backend processes.
https://infinitic.io
Other
340 stars 21 forks source link

Register a workflow with a factory/bean , as we can do for a service #244

Closed nseb closed 3 months ago

nseb commented 4 months ago

Like registering a service I would like to be able to register a workflow with factory/bean with my spring context.

` Autowired private MyServiceFactory myServiceFactory; ...

infiniticWorker.registerWorkflowExecutor(MyService.class.getName() , () -> myServiceFactory.getObject()....); `

geomagilles commented 4 months ago

Note that due to the workflow versioning system (cf. https://docs.infinitic.io/docs/workflows/versioning#new-workflows), we should have also a method with a list of factories

infiniticWorker.registerWorkflowExecutor(workflowName , List.of( () -> Workflow, // e.g version 0 () -> Workflow, // e.g version 1 () -> Workflow, // e.g version 2 ), ....);

@nseb the issue with the workflow factories is that Infinitic has no guarantee that each factory always return the same workflow version. Not sure how to handle this situation.

geomagilles commented 4 months ago

Fixed by 54d3e8ee60aff3e8a0fcfda3dbef848c1ed316e5