camunda-external-task-client-python3 icon indicating copy to clipboard operation
camunda-external-task-client-python3 copied to clipboard

Allow subscribing to a specific businessKey

Open bangeneticalgorithms opened this issue 4 years ago • 2 comments

Right now for when a worker is configured, it subscribes from all businessKeys for a list of topics.

I have a use case where there are multiple process instances running with different business keys.

This behavior is supported in the fetchAndLock REST call.

bangeneticalgorithms avatar Jun 09 '21 17:06 bangeneticalgorithms

  def _get_topics(self, topic_names, process_variables):
          topics = []
          for topic in str_to_list(topic_names):
              dct = {
                  "topicName": topic,
                  "lockDuration": self.config["lockDuration"],
                  "processVariables": process_variables if process_variables else {}
              }
  
              if("businessKey" in self.config):
                  dct["businessKey"] = self.config["businessKey"]
              topics.append(dct)
          return topics

Updating the above method in ExternalTaskClient (external_task_client.py) fixed this.

Will add a PR later today

bangeneticalgorithms avatar Jun 09 '21 18:06 bangeneticalgorithms

Hello @bangeneticalgorithms Can you please add the PR for this functionality? Thank you.

yogeshrnaik avatar Feb 25 '22 04:02 yogeshrnaik