From ace78d5ae4b7f113975908870c6f317254ec5715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20K=C3=B6sner?= Date: Tue, 27 Feb 2024 13:47:01 +0100 Subject: [PATCH] Avoid subscription for user tasks if the deployed processes does not contain any --- .../camunda8/wiring/Camunda8TaskWiring.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/spring-boot/src/main/java/io/vanillabp/camunda8/wiring/Camunda8TaskWiring.java b/spring-boot/src/main/java/io/vanillabp/camunda8/wiring/Camunda8TaskWiring.java index 7b46c9a..c5e8d36 100644 --- a/spring-boot/src/main/java/io/vanillabp/camunda8/wiring/Camunda8TaskWiring.java +++ b/spring-boot/src/main/java/io/vanillabp/camunda8/wiring/Camunda8TaskWiring.java @@ -99,14 +99,16 @@ public void accept( public void openWorkers() { // fetch all usertasks spawned - workers.add( - client - .newWorker() - .jobType("io.camunda.zeebe:userTask") - .handler(userTaskHandler) - .timeout(Integer.MAX_VALUE) // user-tasks are not fetched more than once - .name(workerId) - .tenantIds(userTaskTenantIds.stream().toList())); + if(!userTaskTenantIds.isEmpty()){ + workers.add( + client + .newWorker() + .jobType("io.camunda.zeebe:userTask") + .handler(userTaskHandler) + .timeout(Integer.MAX_VALUE) // user-tasks are not fetched more than once + .name(workerId) + .tenantIds(userTaskTenantIds.stream().toList())); + } workers .forEach(JobWorkerBuilderStep3::open);