Search code examples
cadence-workflowtemporal-workflowuber-cadence

How to effectively use Worker, WorkflowClient


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


Solution

  • 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.