I have to orchestrate a long-running task which involves several tasks, some of the tasks are 3rd party integrations and some others are CPU intensive, so every task has its own worker process. The tasks normally needs the result of the previous long-running task to create something else and pass along the data until I finish the process.
So far I have a lot of events moving around and it looks weird.
Is there a good architectural pattern I can use to improve this?
I will give an example of the process:
- TASK1: Generate some speech using IA in text. (It may take several seconds)
- TASK2: Synthesize the TASK1 text and convert into voice. (It may take several minutes so I have to poll the API until its done)
- TASK3: Transcribe the voice so I can merge into a video later. (It may take several minutes and I have to poll AWS Transcribe API until its completed)
- TASK4: Take outputs from TASK1, TASK2 and TASK3 to render a video clip. (It take several minutes).
I was looking into Saga pattern / Process manager pattern, but all that looks more micro services oriented. What would be a proper solution to this from the orchestration/architecture standpoint?
I am using SQS queues to communicate with worker processes and every worker is a NodeJS processor running in Heroku. The whole process initiates with an API request that triggers the workers.