Question
What is the most efficient way to create additional threads from a thread?
Context
I am redesigning an application to be more efficient. One of the largest improvements will be running concurrent operations; however I am new to concurrent programming. The scenario I am looking to improve is as follows:
We have multiple marketplaces to import orders from and then upload to our ERP system. Each marketplace has multiple record types to import. Currently this is done like MP->RT->RT->RT->RT
where the marketplace(MP
) is invoked, and than subsequent recordtypes(RT
) are added.
What I want to accomplish is a flow like:
MP
|-> RT
|-> RT
|-> RT
|-> RT
MP
|-> RT
|-> RT
...
where multiple marketplaces are invoked, and then multiple record types are added concurrently.
I am currently using an executor service
that controls MP
tasks, but I want to know the best way to handle RT
tasks.