Skip to content

Commit e78ae40

Browse files
Support multi-tenancy per worker (#614)
* formatter * formatter * formatter * introduced configurable tenant ids for workers * remove adding default tenant ids to job worker configuration * update workflow to verify format * added a test to prove a zeebe worker value picks up the tenant ids
1 parent baf86fe commit e78ae40

File tree

163 files changed

+2896
-2224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+2896
-2224
lines changed

.github/workflows/mvn-build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ jobs:
2020
java-version: '21'
2121
distribution: 'adopt'
2222
- name: Build with Maven
23-
run: mvn --batch-mode --update-snapshots package
23+
run: mvn verify -PcheckFormat -B

CONTRIBUTING.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ If you have additional information that can help us understand the behaviour of
2727

2828
If no issue already exists for the bug, please create a new one.
2929

30-
When creating a bug report, please fill out the template. What really helps us are the steps for us to be able reproduce the problem in front of us.
30+
When creating a bug report, please fill out the template. What really helps us are the steps for us to be able reproduce the problem in front of us.
3131

3232
To generate these, start from nothing, and document the steps required to set up a project that shows the bug. If you create such a project as a new GitHub repo, you will have a Minimal Reproducible Example. We can then check out that project and see the bug in front of us immediately. This will increase the speed that we can address the issue. It will also help you isolate the actual issue, and sometimes to fix it.
3333

@@ -45,9 +45,9 @@ If you have additional information that can help us understand the behaviour you
4545

4646
If no issue already exists for the feature request, please create a new one.
4747

48-
When creating a feature request, please fill out the template. What really helps us are both the motivation for the feature (what is your use-case and what you want to achieve), as well as what you would like the feature to be. Sometimes there is an existing way to accomplish what you want, and we may be able to recommend that.
48+
When creating a feature request, please fill out the template. What really helps us are both the motivation for the feature (what is your use-case and what you want to achieve), as well as what you would like the feature to be. Sometimes there is an existing way to accomplish what you want, and we may be able to recommend that.
4949

50-
If there is no existing way to do it, then understanding the use-case that motivates the feature request helps us to triage it, and also to design the feature implementation.
50+
If there is no existing way to do it, then understanding the use-case that motivates the feature request helps us to triage it, and also to design the feature implementation.
5151

5252
## Fix to documentation
5353

@@ -57,7 +57,7 @@ Please read the [Code Style Guidelines](#code-style-guidelines) and [Commit Mess
5757

5858
## Code contribution for an existing issue
5959

60-
Maybe you patch an existing bug, or implement a requested feature for yourself - without waiting for us to get to it. You can contribute that to the codebase as a pull request. This way, you don't end up maintaining a separate fork.
60+
Maybe you patch an existing bug, or implement a requested feature for yourself - without waiting for us to get to it. You can contribute that to the codebase as a pull request. This way, you don't end up maintaining a separate fork.
6161

6262
See the section [Running a development version](#running-a-development-version) for instructions on how to use your fork locally to test your changes.
6363

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.camunda/spring-zeebe/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.camunda/spring-zeebe)
66
[![Project Stats](https://www.openhub.net/p/spring-zeebe/widgets/project_thin_badge.gif)](https://www.openhub.net/p/spring-zeebe)
77

8-
Spring Zeebe will slowly evolve towards Camunda Spring SDK.
8+
Spring Zeebe will slowly evolve towards Camunda Spring SDK.
99

1010
This project allows you to leverage Zeebe, Operate, Optimize, Tasklist, Console, and Modeler within your Spring or Spring Boot environment.
1111

@@ -35,7 +35,7 @@ This project allows you to leverage Zeebe, Operate, Optimize, Tasklist, Console,
3535

3636
## Exciting news: Evolution of Spring-Zeebe into a Camunda Spring SDK
3737

38-
This SDK will support all Camunda Products (Zeebe, Operate, Tasklist, etc) in a unified way.
38+
This SDK will support all Camunda Products (Zeebe, Operate, Tasklist, etc) in a unified way.
3939

4040
What to expect in the coming months:
4141

camunda-sdk-java/java-client-operate/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
This client is part of the Spring Zeebe project. If you intend to use it outside of this project, you can add a dependency to io.camunda.spring:java-client-operate
66
```xml
77
<dependency>
8-
<groupId>io.camunda.spring</groupId>
9-
<artifactId>java-client-operate</artifactId>
10-
<version>8.3.4</version>
8+
<groupId>io.camunda.spring</groupId>
9+
<artifactId>java-client-operate</artifactId>
10+
<version>8.3.4</version>
1111
</dependency>
1212
```
1313

camunda-sdk-java/java-client-operate/src/main/java/io/camunda/operate/CamundaOperateClient.java

+56-22
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import io.camunda.operate.search.SearchQuery;
77
import io.camunda.zeebe.model.bpmn.Bpmn;
88
import io.camunda.zeebe.model.bpmn.BpmnModelInstance;
9-
109
import java.io.ByteArrayInputStream;
1110
import java.io.InputStream;
1211
import java.util.List;
@@ -26,9 +25,8 @@ public ProcessDefinition getProcessDefinition(Long key) throws OperateException
2625
public BpmnModelInstance getProcessDefinitionModel(Long key) throws OperateException {
2726
String xml = getProcessDefinitionXml(key);
2827
try {
29-
InputStream processInputStream = new ByteArrayInputStream(
30-
xml.getBytes());
31-
return Bpmn.readModelFromStream(processInputStream);
28+
InputStream processInputStream = new ByteArrayInputStream(xml.getBytes());
29+
return Bpmn.readModelFromStream(processInputStream);
3230
} catch (Exception e) {
3331
throw new OperateException(e);
3432
}
@@ -38,68 +36,103 @@ public String getProcessDefinitionXml(Long key) throws OperateException {
3836
return httpClient.getXml(ProcessDefinition.class, key);
3937
}
4038

41-
public List<ProcessDefinition> searchProcessDefinitions(SearchQuery query) throws OperateException {
39+
public List<ProcessDefinition> searchProcessDefinitions(SearchQuery query)
40+
throws OperateException {
4241
return searchProcessDefinitionResults(query).getItems();
4342
}
4443

45-
public SearchResult<ProcessDefinition> searchProcessDefinitionResults(SearchQuery query) throws OperateException {
46-
return httpClient.post(SearchResult.class, ProcessDefinition.class, SearchResultTypeToken.searchResultProcessDefinition, query);
44+
public SearchResult<ProcessDefinition> searchProcessDefinitionResults(SearchQuery query)
45+
throws OperateException {
46+
return httpClient.post(
47+
SearchResult.class,
48+
ProcessDefinition.class,
49+
SearchResultTypeToken.searchResultProcessDefinition,
50+
query);
4751
}
4852

49-
public List<DecisionDefinition> searchDecisionDefinitions(SearchQuery query) throws OperateException {
53+
public List<DecisionDefinition> searchDecisionDefinitions(SearchQuery query)
54+
throws OperateException {
5055
return searchDecisionDefinitionResults(query).getItems();
5156
}
5257

53-
public SearchResult<DecisionDefinition> searchDecisionDefinitionResults(SearchQuery query) throws OperateException {
54-
return httpClient.post(SearchResult.class, DecisionDefinition.class, SearchResultTypeToken.searchResultDecisionDefinition, query);
58+
public SearchResult<DecisionDefinition> searchDecisionDefinitionResults(SearchQuery query)
59+
throws OperateException {
60+
return httpClient.post(
61+
SearchResult.class,
62+
DecisionDefinition.class,
63+
SearchResultTypeToken.searchResultDecisionDefinition,
64+
query);
5565
}
5666

5767
public List<DecisionInstance> searchDecisionInstances(SearchQuery query) throws OperateException {
5868
return searchDecisionInstanceResults(query).getItems();
5969
}
6070

61-
public SearchResult<DecisionInstance> searchDecisionInstanceResults(SearchQuery query) throws OperateException {
62-
return httpClient.post(SearchResult.class, DecisionInstance.class, SearchResultTypeToken.searchResultDecisionInstance, query);
71+
public SearchResult<DecisionInstance> searchDecisionInstanceResults(SearchQuery query)
72+
throws OperateException {
73+
return httpClient.post(
74+
SearchResult.class,
75+
DecisionInstance.class,
76+
SearchResultTypeToken.searchResultDecisionInstance,
77+
query);
6378
}
6479

6580
public List<FlowNodeInstance> searchFlowNodeInstances(SearchQuery query) throws OperateException {
6681
return searchFlowNodeInstanceResults(query).getItems();
6782
}
6883

69-
public SearchResult<FlowNodeInstance> searchFlowNodeInstanceResults(SearchQuery query) throws OperateException {
70-
return httpClient.post(SearchResult.class, FlowNodeInstance.class, SearchResultTypeToken.searchResultFlowNodeInstance, query);
84+
public SearchResult<FlowNodeInstance> searchFlowNodeInstanceResults(SearchQuery query)
85+
throws OperateException {
86+
return httpClient.post(
87+
SearchResult.class,
88+
FlowNodeInstance.class,
89+
SearchResultTypeToken.searchResultFlowNodeInstance,
90+
query);
7191
}
7292

7393
public List<Variable> searchVariables(SearchQuery query) throws OperateException {
7494
return searchVariableResults(query).getItems();
7595
}
7696

7797
public SearchResult<Variable> searchVariableResults(SearchQuery query) throws OperateException {
78-
return httpClient.post(SearchResult.class, Variable.class, SearchResultTypeToken.searchResultVariable, query);
98+
return httpClient.post(
99+
SearchResult.class, Variable.class, SearchResultTypeToken.searchResultVariable, query);
79100
}
80101

81102
public List<ProcessInstance> searchProcessInstances(SearchQuery query) throws OperateException {
82103
return searchProcessInstanceResults(query).getItems();
83104
}
84105

85-
public SearchResult<ProcessInstance> searchProcessInstanceResults(SearchQuery query) throws OperateException {
86-
return httpClient.post(SearchResult.class, ProcessInstance.class, SearchResultTypeToken.searchResultProcessInstance, query);
106+
public SearchResult<ProcessInstance> searchProcessInstanceResults(SearchQuery query)
107+
throws OperateException {
108+
return httpClient.post(
109+
SearchResult.class,
110+
ProcessInstance.class,
111+
SearchResultTypeToken.searchResultProcessInstance,
112+
query);
87113
}
88114

89-
public List<DecisionRequirements> searchDecisionRequirements(SearchQuery query) throws OperateException {
115+
public List<DecisionRequirements> searchDecisionRequirements(SearchQuery query)
116+
throws OperateException {
90117
return searchDecisionRequirementsResults(query).getItems();
91118
}
92119

93-
public SearchResult<DecisionRequirements> searchDecisionRequirementsResults(SearchQuery query) throws OperateException {
94-
return httpClient.post(SearchResult.class, DecisionRequirements.class, SearchResultTypeToken.searchResultDecisionRequirements, query);
120+
public SearchResult<DecisionRequirements> searchDecisionRequirementsResults(SearchQuery query)
121+
throws OperateException {
122+
return httpClient.post(
123+
SearchResult.class,
124+
DecisionRequirements.class,
125+
SearchResultTypeToken.searchResultDecisionRequirements,
126+
query);
95127
}
96128

97129
public List<Incident> searchIncidents(SearchQuery query) throws OperateException {
98130
return searchIncidentResults(query).getItems();
99131
}
100132

101133
public SearchResult<Incident> searchIncidentResults(SearchQuery query) throws OperateException {
102-
return httpClient.post(SearchResult.class, Incident.class, SearchResultTypeToken.searchResultIncident, query);
134+
return httpClient.post(
135+
SearchResult.class, Incident.class, SearchResultTypeToken.searchResultIncident, query);
103136
}
104137

105138
public ProcessInstance getProcessInstance(Long key) throws OperateException {
@@ -111,7 +144,8 @@ public ChangeStatus deleteProcessInstance(Long key) throws OperateException {
111144
}
112145

113146
public List<FlowNodeStatistics> getFlowNodeStatistics(Long key) throws OperateException {
114-
return httpClient.get(List.class, FlowNodeStatistics.class, ListTypeToken.listFlowNodeStatistics, key);
147+
return httpClient.get(
148+
List.class, FlowNodeStatistics.class, ListTypeToken.listFlowNodeStatistics, key);
115149
}
116150

117151
public List<String> getSequenceFlows(Long key) throws OperateException {

camunda-sdk-java/java-client-operate/src/main/java/io/camunda/operate/CamundaOperateClientBuilder.java

+15-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import io.camunda.common.http.DefaultHttpClient;
66
import io.camunda.common.http.HttpClient;
77
import io.camunda.operate.model.*;
8-
98
import java.util.HashMap;
109
import java.util.Map;
1110

@@ -16,7 +15,6 @@ public class CamundaOperateClientBuilder {
1615
private String operateUrl;
1716
private HttpClient httpClient;
1817

19-
2018
public CamundaOperateClientBuilder authentication(Authentication authentication) {
2119
this.authentication = authentication;
2220
return this;
@@ -42,12 +40,21 @@ public CamundaOperateClientBuilder setup() {
4240
map.put(DecisionDefinition.class, "/decision-definitions");
4341
map.put(DecisionRequirements.class, "/drd");
4442
map.put(DecisionInstance.class, "/decision-instances");
45-
map.put(SearchResultTypeToken.searchResultProcessDefinition.getClass(), "/process-definitions/search");
46-
map.put(SearchResultTypeToken.searchResultDecisionDefinition.getClass(), "/decision-definitions/search");
47-
map.put(SearchResultTypeToken.searchResultDecisionInstance.getClass(), "/decision-instances/search");
48-
map.put(SearchResultTypeToken.searchResultFlowNodeInstance.getClass(), "/flownode-instances/search");
43+
map.put(
44+
SearchResultTypeToken.searchResultProcessDefinition.getClass(),
45+
"/process-definitions/search");
46+
map.put(
47+
SearchResultTypeToken.searchResultDecisionDefinition.getClass(),
48+
"/decision-definitions/search");
49+
map.put(
50+
SearchResultTypeToken.searchResultDecisionInstance.getClass(),
51+
"/decision-instances/search");
52+
map.put(
53+
SearchResultTypeToken.searchResultFlowNodeInstance.getClass(),
54+
"/flownode-instances/search");
4955
map.put(SearchResultTypeToken.searchResultVariable.getClass(), "/variables/search");
50-
map.put(SearchResultTypeToken.searchResultProcessInstance.getClass(), "/process-instances/search");
56+
map.put(
57+
SearchResultTypeToken.searchResultProcessInstance.getClass(), "/process-instances/search");
5158
map.put(SearchResultTypeToken.searchResultDecisionRequirements.getClass(), "/drd/search");
5259
map.put(SearchResultTypeToken.searchResultIncident.getClass(), "/incidents/search");
5360
httpClient.loadMap(Product.OPERATE, map);
@@ -56,7 +63,7 @@ public CamundaOperateClientBuilder setup() {
5663

5764
private String formatUrl(String url) {
5865
if (url.endsWith("/")) {
59-
return url.substring(0, url.length()-1);
66+
return url.substring(0, url.length() - 1);
6067
}
6168
return url;
6269
}
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
package io.camunda.operate.exception;
22

33
public class OperateException extends Exception {
4-
private static final long serialVersionUID = -7593616210087047797L;
4+
private static final long serialVersionUID = -7593616210087047797L;
55

6-
public OperateException() {
7-
super();
8-
}
6+
public OperateException() {
7+
super();
8+
}
99

10-
public OperateException(Exception e) {
11-
super(e);
12-
}
10+
public OperateException(Exception e) {
11+
super(e);
12+
}
1313

14-
public OperateException(String message) {
15-
super(message);
16-
}
14+
public OperateException(String message) {
15+
super(message);
16+
}
1717

18-
public OperateException(String message, Exception e) {
19-
super(message, e);
20-
}
18+
public OperateException(String message, Exception e) {
19+
super(message, e);
20+
}
2121
}

camunda-sdk-java/java-client-operate/src/main/java/io/camunda/operate/model/ChangeStatus.java

-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,4 @@ public Long getDeleted() {
2020
public void setDeleted(Long deleted) {
2121
this.deleted = deleted;
2222
}
23-
2423
}

camunda-sdk-java/java-client-operate/src/main/java/io/camunda/operate/model/DecisionInstanceInput.java

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ public class DecisionInstanceInput {
55
private String id;
66
private String name;
77
private String value;
8+
89
public String getId() {
910
return id;
1011
}

camunda-sdk-java/java-client-operate/src/main/java/io/camunda/operate/model/DecisionRequirements.java

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public class DecisionRequirements {
99
private Long version;
1010
private String resourceName;
1111
private String tenantId;
12+
1213
public String getId() {
1314
return id;
1415
}

0 commit comments

Comments
 (0)