temporalio / sdk-java

Temporal Java SDK
https://temporal.io
Apache License 2.0
200 stars 134 forks source link

Add the ability to specify worker identity for each worker #2078

Closed Duzhinsky closed 1 month ago

Duzhinsky commented 1 month ago

Is your feature request related to a problem? Please describe. It is assumed that in a single application, there are multiple workers that operate for different queues. Due to internal integrations in our infrastructure, I must specify a queue in the identity property. The worker is created using a WorkerFactory, which is linked to a WorkflowClient. Currently, there is only the ability to specify identity for the client.

Describe the solution you'd like I propose the introduction of an option to assign an identity within WorkerOptions, and for this identity to be treated as a priority when SingleWorkerOptions are being configured.

https://github.com/temporalio/sdk-java/blob/5e5cf0bf2db695cba46d1855959e02b4cdfa3cff/temporal-sdk/src/main/java/io/temporal/worker/Worker.java#L586-L608

Describe alternatives you've considered A possible workaround could involve creating a distinct WorkflowClient for every queue, which in turn would necessitate a separate WorkerFactory for each. However, employing a single client is fully sufficient for the application's needs.