Best Architecture for Scheduled Workflows

Hi,

We have a microservice that runs in a container. We need to run temporal scheduled workflows using the same codebase.We have 2 separate temporal worker containers that will execute the scheduled workflows. The worker containers are separate from the main container We have 2 proposed architectures but we are not sure which one is best from temporal’s standpoint.

  1. Put the starter code in the main container so that on its startup, it will register the scheduled activities with the temporal server

  2. Put the starter code as a go routine in the worker containers so that it registers the workflows when the workers startup

We will be using a unique WorkflowID to prevent duplicate scheduled workflows for both approaches. What would be the best architecture here from temporal’s standpoint?

Thanks,
Mark

Temporal doesn’t really care about which component starts the workflows. I personally would put the workflow startup code into the same container that hosts the workflow code to keep all the logic in one place.

1 Like