Preferences

The pattern I would recommend in such cases is having one service be responsible for the overall workflow and then call the other services as steps.

So if you were for example running a website and wanted to have a "cancellation" flow, you'd have the cancellation service with the workflow inside of it, which would have all the steps defined, like

1) disable user account

2) mark user data as archived

3) cancel recurring payments

And then each step would call the service that actually does that work, using an idempotency key. Each service might have its own internal workflows to accomplish each task. In this case step 1 would call the accounts service, step two would call the storage service, and step three would call the payment service.

But then you have a clean reusable interface in each service, as well as a single service responsible for the workflow.


rileymichael
the OP wasn't clear but that's effectively what i settled on by launching workflows (within steps) via the dbos client. keeping that an implementation detail in each service though is probably better + solves the db awareness, just need to do the endpoint/rpc plumbing. thanks!

This item has no comments currently.