On the worker docs page it says:
A single Worker Entity can listen to only a single Task Queue. But if a Worker Process has multiple Worker Entities, the Worker Process could be listening to multiple Task Queues.
How can this be accomplished with the typescript-sdk?
Do I just need to create two worker scripts (like these) and then use something like npm-run-all or concurrently to run them both in the same process?
You can either run the workers in separate processes or in the same process using:
const workers = await Promise.all([Worker.create(...), ...])
await Promise.all(workers.map((worker) => worker.run()))
The upside of using multiple processes is that you could more easily leverage more CPU cores in Node.js that usually only leverages a single thread.
SDK workers use multiple threads behind the scenes but activities run in the main Node.js thread and extra care should be taken to avoid blocking the CPU for long periods of time.
See also sdk-typescript/activation.mermaid at main · temporalio/sdk-typescript · GitHub