Skip to content

Commit

Permalink
Merge pull request #68 from camunda-community-hub/bugfix/issue-67-fix…
Browse files Browse the repository at this point in the history
…-npe-for-non-tenant-configs

fix(user-task): prevent npe for non-tenant configurations
  • Loading branch information
stephanpelikan authored Dec 6, 2024
2 parents 5ddd512 + 512d3a5 commit 2430dfd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,12 @@ public void openWorkers() {
.jobType("io.camunda.zeebe:userTask")
.handler(userTaskHandler)
.timeout(Integer.MAX_VALUE) // user-tasks are not fetched more than once
.name(workerId)
.tenantId(tenantId);
.name(workerId);

if (tenantId != null) {
userTaskWorker.tenantId(tenantId);
}

final var workerProperties = camunda8Properties.getUserTaskWorkerProperties(workflowModuleId);
workerProperties.applyToUserTaskWorker(userTaskWorker);
return userTaskWorker;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ public class Camunda8UserTaskHandler implements JobHandler {
private static final Logger logger = LoggerFactory.getLogger(Camunda8UserTaskHandler.class);

private static final int MAX_ATTEMPTS_OF_ASSIGNING_USERTASKS = 1000;


// default tenant identifier used by camunda 8 if multi-tenancy is disabled
// see https://docs.camunda.io/docs/self-managed/concepts/multi-tenancy/#the-tenant-identifier
private static final String DEFAULT_TENANT_ID = "<default>";

private final Map<String, Camunda8TaskHandler> taskHandlers = new HashMap<>();

private final String workerId;
Expand All @@ -31,8 +35,8 @@ private String internalKey(
final String tenantId,
final String bpmnProcessId,
final String elementId) {

return tenantId + "#" + bpmnProcessId + "#" + elementId;
final var tenantIdKey = DEFAULT_TENANT_ID.equals(tenantId) ? null : tenantId;
return tenantIdKey + "#" + bpmnProcessId + "#" + elementId;

}

Expand Down

0 comments on commit 2430dfd

Please sign in to comment.