Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(user-task): prevent npe for non-tenant configurations #68

Merged
merged 2 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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