Java External Task Client - Dynamically Create Topic Subscriptions

Hey there,

I am pondering whether or not it is possible to add topic subscriptions to an already running external task client instance, i.e. to dynmically reload topics so that the task handler considers those on the fly.

Is that possible or do I need to restart the client every time it is supposed to listen to further topics?

Thank you very much in advance,
Best

Hi @astro ,

yes, this is possible.

If you use TopicSubscriptionBuilder builder = client.subscribe(topicName) to create a new topic registration and then start listening calling open().

You just need to inject the “client” or get it somehow - depends on your environment.

I you want to see code: as the author of the Micronaut Camunda Integration I’d point you to micronaut-camunda-external-client/ExternalWorkerSubscriptionCreator.java at main · camunda-community-hub/micronaut-camunda-external-client · GitHub :slight_smile:

Tobias

1 Like