0

Product Use Case - Our product has a typical use case where we will be having n no of users. Each user will have n no of workflows and each workflow can be run at any time(n of time).

I hope this is a typical use case of any workflow product.

can I use a domain to differentiate users (I mean to say that creating a domain per user)?

Can I create one WorkflowClient per user to serve all his workflow executions? Or for each request should I need to create one WorkflowClient? which one is a recommended approach?

What is the recommended approach in creating Worker objects to poll task list?

Please don't mistake me If I have asked anything meaningless

2 Answers2

0

can I use a domain to differentiate users (I mean to say that creating a domain per user)?

Yes, especially when these users are working in different teams or product, using different domain will avoid workflowName/IDs conflicting each others, and also assign independent number of quotas for managing traffic.

Can I create one WorkflowClient per user to serve all his workflow executions? Or for each request should I need to create one WorkflowClient? which one is a recommended approach?

Use one WorkflowClient for each domain, but let all WorkflowClients on the same instance share the same TChannelService to save the TCP connection.

Long Quanzheng
  • 2,076
  • 1
  • 10
  • 22
  • Thanks for the response!! What is the recommended approach in creating Worker objects to poll task list ?? – Anil Kumble May 19 '21 at 18:06
  • You are suggesting me to use ''all WorkflowClients on the same instance share the same TChannelService to save the TCP connection''. What do you mean by same instance ? – Anil Kumble May 19 '21 at 18:10
  • It means: the same instance(by EC2 concept) host(by physical machine concept) or Pod(by K8s concept) that running the worker code with the same CPU/memory. – Long Quanzheng May 19 '21 at 18:42
0

I would start with a single namespace (domain) for all users. Unless your users directly operate their workflow implementations it doesn't buy you much to use multiple namespaces.

Maxim Fateev
  • 6,458
  • 3
  • 20
  • 35
  • Thanks Maxim!! What is the recommended approach in creating worker objects and assigning tasks to them?? – Anil Kumble May 20 '21 at 02:21
  • I"m not sure I understand the question. You don't manually assign tasks to them. A worker is configured to listen on a task queue. So all the tasks scheduled into that queue are picked up by one of the workers listening on that queue. – Maxim Fateev May 20 '21 at 02:22
  • Yes, I understand that the worker is listening for the queue and it is picking it tasks from them. I want to know how to create Workers in my application? In `WorkflowMethod and ActivityMethod annotation` we will have an option to assign taskList. How to assign it? `On what basis we have to assign taskList?` `Can I create two or more workers which will listen for the same TaskList?` – Anil Kumble May 20 '21 at 04:57
  • This is SDK dependent. I recommend looking into the documentation. Here is the way it is done in Java: https://docs.temporal.io/docs/java/workers. It doesn't make sense to host more than one worker listening to the same task queue in the same process. But it is expected that multiple processes listen on the same task queue for scalability and availability. – Maxim Fateev May 20 '21 at 15:40