Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Add API surface area for multi-tenancy #330

Closed
jwulf opened this issue Aug 9, 2023 · 11 comments
Closed

Add API surface area for multi-tenancy #330

jwulf opened this issue Aug 9, 2023 · 11 comments
Assignees
Labels
enhancement New feature or request needed-downstream A project that depends on the client is blocked by this
Milestone

Comments

@jwulf
Copy link
Member

jwulf commented Aug 9, 2023

Multi-tenancy is coming.

This task is to add support to the API surface of the client, with no change to the implementation as yet (the gRPC protocol implementation has not landed yet).

The methods will not do anything in the client but will allow consumers of zeebe-node to use the methods during development.

See the Java client task here: camunda/camunda#13517

Schema changes

The following commands need a way to specify a tenant:

  • DeployResource RPC
  • CreateProcessInstance RPC
  • CreateProcessInstanceWithResult RPC
  • EvaluateDecision RPC
  • BroadcastSignal RPC
  • PublishMessage RPC

The following commands need a way to specify one or more tenants:

  • ActivateJobs RPC
  • StreamJobs RPC (we can consider this one out of scope for this issue)

Out of scope

The following commands are unaffected:

  • ModifyProcessInstance RPC
  • CancelProcessInstance RPC
  • UpdateJobRetries RPC
  • CompleteJob RPC
  • FailJob RPC
  • ThrowError RPC
  • ResolveIncident RPC
  • SetVariables RPC
  • Topology RPC
@jwulf jwulf self-assigned this Aug 9, 2023
@jwulf
Copy link
Member Author

jwulf commented Aug 9, 2023

Required by the Desktop Modeler: camunda/camunda-modeler#3716

@jwulf
Copy link
Member Author

jwulf commented Aug 10, 2023

I am going to remove the method overloads for createProcessInstance and createProcessInstanceWithResult, leaving only the object parameter method.

So:

zbc.createProcessInstanceWithResult({
   bpmnProcessId: 'order-process',
   variables: {
     customerId: 123,
     invoiceId: 567
   }
})
zbc.createProcessInstance({
  bpmnProcessId: 'test-process',
  variables: {
    testData: 'something'
  }
})

The rationale for this is: adding tenantId to all the method signatures increases the complexity. To reduce complexity, I will remove method overloads.

@jwulf
Copy link
Member Author

jwulf commented Aug 10, 2023

Published package 8.3.0-alpha4.

To do: deployProcess needs to be modified. Maybe it won't support tenantId, because it can take an object, a string, or an array of strings - which doesn't give us a single way to do it - other than a second argument.

@jwulf
Copy link
Member Author

jwulf commented Aug 10, 2023

Opened a PR for the Modeler team to test integrating the new APIs in 8.3.0-alpha4: camunda/camunda-modeler#3772

@jwulf
Copy link
Member Author

jwulf commented Aug 14, 2023

Based on the Operate team's use of the Zeebe Node library, rather than breaking the deployProcess API in the library, I plan to mark it as deprecated, and add support for multi-tenancy to the deployResource API.

This means that users wanting to use the new feature will need to refactor code to use this API, and there will be no change for users who are using the older API and do not wish to use the new feature.

User refactoring is then both motivated by and rewarded by a new feature: multi-tenancy support.

@jwulf jwulf added enhancement New feature or request needed-downstream A project that depends on the client is blocked by this labels Aug 15, 2023
@nikku
Copy link
Contributor

nikku commented Aug 16, 2023

To consider: Add defaultTenantId that can be provided on client instantiation. This would mirror what is currently planned for the Java API and make single tenant applications simpler (i.e. Camunda Desktop Modeler).

@jwulf
Copy link
Member Author

jwulf commented Aug 22, 2023

This is a very good idea. If the constructor / env vars provide the tenantIdon client instantiation, then the tenantId can be added to any method invocation.

@akeller
Copy link
Contributor

akeller commented Oct 10, 2023

@jwulf can you add a status here for this work?

@jwulf jwulf added this to the 8.3.0 milestone Oct 20, 2023
@jwulf
Copy link
Member Author

jwulf commented Oct 24, 2023

The published 8.3.0-alpha8 and 8.3.0-alpha9 packages include the fix for full multi-tenancy support.

@jwulf
Copy link
Member Author

jwulf commented Oct 26, 2023

I tested it with Desktop Modeler against Self-Managed multi-tenant, and it works. Will push 8.3.0 package early next week.

@jwulf
Copy link
Member Author

jwulf commented Nov 1, 2023

Published in 8.3.0

@jwulf jwulf closed this as completed Nov 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request needed-downstream A project that depends on the client is blocked by this
Projects
None yet
Development

No branches or pull requests

3 participants