Need help on designing work flow structure

Hi Everyone,

We have use-case of generating some reports in the beginning as well as end of the day.

Each report generation is different activity connecting to DB/Micro Service to retrieve the result and we are running them asynchronously.

End of the day workflow will going to generate around 4 times more report than beginning of the day workflow.

Need help decide the approach to move forward

  1. Use two different workflow listening to same task-queue and worker
  2. Create Single workflow interface with two implementation and then create two different task queue for listening each of them.

Tech-stack → We are using (Java) temporal sping alpha project to configure or workers)

Doubt → If we move forward with second approach and let say running only one process containing both worker how to manage the resource allocation among these resources as EOD workflow is more intensive then the beginning of the day.

Thanks

You can execute multiple workflows on a single worker. There’s no need to assign one worker per workflow.

Thanks Jordan, completely agree earlier we have been following the same pattern of having single worker listening to both the workflow.

Wanted to understood is there any disadvantage of having multiple implementation of single interface and then registering to multiple worker. This approach making our code more readable as the workflow are performing similar actions.

We are starting both the worker using java spring alpha project also wanted to understand how to manage the resource allocation among both of the worker incase there are placed in single process.

There is no disadvantage to having your workflow on multiple workers. However, it is not needed, one worker is capable of handling this. Please note that multiple workers of the same task queue for the same process is not a good idea.

Are you benchmarking this? There would be no reason for the multiple workers to be placed in a single process.

workers:
      - task-queue: first-task-queue
        name: firt-worker
        workflow-classes:
          - workflow1Impl
        activity-beans:
          - Actiivty1Impl
      - task-queue: second-task-queue
        name: second-worker
        workflow-classes:
          - workflow2Impl 
        activity-beans:
          - Actiivty2Impl 

We have configured our workers in the above manner using spring-boot-starter-temporal and starting up the application provide us 2 worker under single process.

Could you please let us know how to make sure to start these worker in separate processes of each of them and is there way through config only we can control resource allocation among them?

P.S → Also in the above example according to our use-case workflow1Impl an workflow2Impl are implementation from the single workflow interface reason we required separate worker for them.

I think using the same workflow type for different workflow implementations is usually confusing. What is the use case for this?

Yeah absolutely correct maxim.

Here is our use-case → Generating some reports in the beginning as well as end of the day.

Each report generation is different activity connecting to DB/Micro Service to retrieve the result and we are running them asynchronously.

End of the day workflow will going to generate around 4 times more report than beginning of the day workflow.

As workflow have similar action we thought of going ahead of single interface having 2 implementation ( BOD and EOD each ) as each of them contain different activities to generate it’s helps us improving code readability.

Please suggest is there any disadvantage of this approach or do we have to move forward with having two independent workflow ?

To me, this looks like two separate workflow types. Note that workflows can reference the same code if they share some logic.