Best practice to contract taskQueue name between Caller and Worker

We recently started using Temporal Cloud and we are mostly a Java house using Spring.

I am creating some base libraries to facilitate integration between the Temporal SDK and Spring. I am also creating blueprints of how code should be structured and shared among different services libraries.

The bit I am struggling with is how to contract neatly the taskQueue name between a service starting a Workflow and the Worker hosting it. Is there some best practice other than hardcoding the value?

You can think about a task queue as “endpoint name” of a worker that hosts the workflow. So hardcoding makes sense unless you plan to use task queue names to support more complex scenarios like versioning.

Understood. I guess I was overthinking it. Thank you for the feedback.

Versioning was one of the reasons why I was asking since I had noticed a note about it on the docs: https://docs.temporal.io/workflows#workflow-versioning

However, I am leaning towards handling versioning with backward compatible implementations through the versioning API. Since a change in the implementation would be transparent interface-wise, so the caller would have no idea of that happening.

In the case, the interface changes, I would create a new interface altogether since it’s basically a new contract.

1 Like