Skip to content

Commit e7c3e01

Browse files
v2 client (#347)
* v2 client * formatted * removed * added toVariable * adjusted readme
1 parent c8f4b44 commit e7c3e01

File tree

23 files changed

+1578
-281
lines changed

23 files changed

+1578
-281
lines changed

README.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ Add the dependency to your project:
2424
</dependency>
2525
```
2626

27+
This client is compatible with the Camunda v2 API. To use it, please configure:
28+
29+
```yaml
30+
tasklist:
31+
client:
32+
api-version: v2
33+
```
34+
2735
Configure a Camunda Tasklist client with simple authentication:
2836
2937
```yaml
@@ -124,24 +132,26 @@ Add the dependency to your project:
124132
Build a Camunda Tasklist client with simple authentication:
125133

126134
```java
127-
// properties you need to provide
135+
// properties you need to provide
136+
ApiVersion apiVersion = ApiVersion.v1;
128137
String username = "demo";
129138
String password = "demo";
130139
URL tasklistUrl = URI.create("http://localhost:8082").toURL();
131140
boolean returnVariables = false;
132141
boolean loadTruncatedVariables = false;
133142
boolean useZeebeUserTasks = true;
134-
// if you are using zeebe user tasks, you require a zeebe client as well
135-
ZeebeClient zeebeClient = zeebeClient();
143+
// if you are using camunda user tasks, you require a camunda client as well
144+
CamundaClient camundaClient = camundaClient();
136145
// bootstrapping
137146
SimpleCredential credentials =
138147
new SimpleCredential(username, password, tasklistUrl, Duration.ofMinutes(10));
139148
SimpleAuthentication authentication = new SimpleAuthentication(credentials);
140149
CamundaTasklistClientConfiguration configuration =
141150
new CamundaTasklistClientConfiguration(
151+
apiVersion,
142152
authentication,
143153
tasklistUrl,
144-
zeebeClient,
154+
camundaClient,
145155
new DefaultProperties(returnVariables, loadTruncatedVariables, useZeebeUserTasks));
146156
CamundaTaskListClient client = new CamundaTaskListClient(configuration);
147157
```
@@ -150,6 +160,7 @@ Build a Camunda Tasklist client with identity authentication:
150160

151161
```java
152162
// properties you need to provide
163+
ApiVersion apiVersion = ApiVersion.v1;
153164
String clientId = "";
154165
String clientSecret = "";
155166
String audience = "tasklist-api";
@@ -162,8 +173,8 @@ URL authUrl =
162173
boolean returnVariables = false;
163174
boolean loadTruncatedVariables = false;
164175
boolean useZeebeUserTasks = true;
165-
// if you are using zeebe user tasks, you require a zeebe client as well
166-
ZeebeClient zeebeClient = zeebeClient();
176+
// if you are using camunda user tasks, you require a camunda client as well
177+
CamundaClient camundaClient = camundaClient();
167178
// bootstrapping
168179
JwtCredential credentials =
169180
new JwtCredential(clientId, clientSecret, audience, authUrl, scope);
@@ -173,9 +184,10 @@ TokenResponseHttpClientResponseHandler clientResponseHandler =
173184
JwtAuthentication authentication = new JwtAuthentication(credentials, clientResponseHandler);
174185
CamundaTasklistClientConfiguration configuration =
175186
new CamundaTasklistClientConfiguration(
187+
apiVersion,
176188
authentication,
177189
tasklistUrl,
178-
zeebeClient,
190+
camundaClient,
179191
new DefaultProperties(returnVariables, loadTruncatedVariables, useZeebeUserTasks));
180192
CamundaTaskListClient client = new CamundaTaskListClient(configuration);
181193
```
@@ -184,15 +196,16 @@ Build a Camunda Tasklist client for Saas:
184196

185197
```java
186198
// properties you need to provide
199+
ApiVersion apiVersion = ApiVersion.v1;
187200
String region = "";
188201
String clusterId = "";
189202
String clientId = "";
190203
String clientSecret = "";
191204
boolean returnVariables = false;
192205
boolean loadTruncatedVariables = false;
193206
boolean useZeebeUserTasks = true;
194-
// if you are using zeebe user tasks, you require a zeebe client as well
195-
ZeebeClient zeebeClient = zeebeClient();
207+
// if you are using camunda user tasks, you require a camunda client as well
208+
CamundaClient camundaClient = camundaClient();
196209
// bootstrapping
197210
URL tasklistUrl =
198211
URI.create("https://" + region + ".tasklist.camunda.io/" + clusterId).toURL();
@@ -205,9 +218,10 @@ TokenResponseHttpClientResponseHandler clientResponseHandler =
205218
JwtAuthentication authentication = new JwtAuthentication(credentials, clientResponseHandler);
206219
CamundaTasklistClientConfiguration configuration =
207220
new CamundaTasklistClientConfiguration(
221+
apiVersion,
208222
authentication,
209223
tasklistUrl,
210-
zeebeClient,
224+
camundaClient,
211225
new DefaultProperties(returnVariables, loadTruncatedVariables, useZeebeUserTasks));
212226
CamundaTaskListClient client = new CamundaTaskListClient(configuration);
213227
```

example/bootstrapping-test/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</dependency>
1919
<dependency>
2020
<groupId>io.camunda</groupId>
21-
<artifactId>zeebe-client-java</artifactId>
21+
<artifactId>camunda-client-java</artifactId>
2222
</dependency>
2323
<dependency>
2424
<groupId>org.junit.jupiter</groupId>

example/bootstrapping-test/src/main/java/io/camunda/tasklist/bootstrapping/Bootstrapper.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import io.camunda.tasklist.CamundaTaskListClient;
44
import io.camunda.tasklist.CamundaTasklistClientConfiguration;
5+
import io.camunda.tasklist.CamundaTasklistClientConfiguration.ApiVersion;
56
import io.camunda.tasklist.CamundaTasklistClientConfiguration.DefaultProperties;
67
import io.camunda.tasklist.auth.SimpleAuthentication;
78
import io.camunda.tasklist.auth.SimpleCredential;
@@ -14,6 +15,7 @@ public CamundaTaskListClient create() {
1415
try {
1516
return new CamundaTaskListClient(
1617
new CamundaTasklistClientConfiguration(
18+
ApiVersion.v1,
1719
new SimpleAuthentication(
1820
new SimpleCredential(
1921
"demo",

example/readme-snippets/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</dependency>
2323
<dependency>
2424
<groupId>io.camunda</groupId>
25-
<artifactId>zeebe-client-java</artifactId>
25+
<artifactId>camunda-client-java</artifactId>
2626
</dependency>
2727
</dependencies>
2828

example/readme-snippets/src/main/java/io/camunda/tasklist/example/TasklistClientBootstrapper.java

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
package io.camunda.tasklist.example;
22

33
import com.fasterxml.jackson.databind.ObjectMapper;
4+
import io.camunda.client.CamundaClient;
45
import io.camunda.tasklist.CamundaTaskListClient;
56
import io.camunda.tasklist.CamundaTasklistClientConfiguration;
7+
import io.camunda.tasklist.CamundaTasklistClientConfiguration.ApiVersion;
68
import io.camunda.tasklist.CamundaTasklistClientConfiguration.DefaultProperties;
79
import io.camunda.tasklist.auth.JwtAuthentication;
810
import io.camunda.tasklist.auth.JwtCredential;
911
import io.camunda.tasklist.auth.SimpleAuthentication;
1012
import io.camunda.tasklist.auth.SimpleCredential;
1113
import io.camunda.tasklist.auth.TokenResponseHttpClientResponseHandler;
12-
import io.camunda.zeebe.client.ZeebeClient;
1314
import java.net.MalformedURLException;
1415
import java.net.URI;
1516
import java.net.URL;
1617
import java.time.Duration;
1718

1819
public interface TasklistClientBootstrapper {
19-
static ZeebeClient zeebeClient() {
20-
return ZeebeClient.newClientBuilder().build();
20+
static CamundaClient camundaClient() {
21+
return CamundaClient.newClientBuilder().build();
2122
}
2223

2324
CamundaTaskListClient createTasklistClient() throws MalformedURLException;
@@ -27,23 +28,25 @@ class SimpleAuthTasklistClientBootstrapper implements TasklistClientBootstrapper
2728
@Override
2829
public CamundaTaskListClient createTasklistClient() throws MalformedURLException {
2930
// properties you need to provide
31+
ApiVersion apiVersion = ApiVersion.v1;
3032
String username = "demo";
3133
String password = "demo";
3234
URL tasklistUrl = URI.create("http://localhost:8082").toURL();
3335
boolean returnVariables = false;
3436
boolean loadTruncatedVariables = false;
3537
boolean useZeebeUserTasks = true;
36-
// if you are using zeebe user tasks, you require a zeebe client as well
37-
ZeebeClient zeebeClient = zeebeClient();
38+
// if you are using camunda user tasks, you require a camunda client as well
39+
CamundaClient camundaClient = camundaClient();
3840
// bootstrapping
3941
SimpleCredential credentials =
4042
new SimpleCredential(username, password, tasklistUrl, Duration.ofMinutes(10));
4143
SimpleAuthentication authentication = new SimpleAuthentication(credentials);
4244
CamundaTasklistClientConfiguration configuration =
4345
new CamundaTasklistClientConfiguration(
46+
apiVersion,
4447
authentication,
4548
tasklistUrl,
46-
zeebeClient,
49+
camundaClient,
4750
new DefaultProperties(returnVariables, loadTruncatedVariables, useZeebeUserTasks));
4851
CamundaTaskListClient client = new CamundaTaskListClient(configuration);
4952
return client;
@@ -54,6 +57,7 @@ class IdentityAuthTasklistClientBootstrapper implements TasklistClientBootstrapp
5457
@Override
5558
public CamundaTaskListClient createTasklistClient() throws MalformedURLException {
5659
// properties you need to provide
60+
ApiVersion apiVersion = ApiVersion.v1;
5761
String clientId = "";
5862
String clientSecret = "";
5963
String audience = "tasklist-api";
@@ -66,8 +70,8 @@ public CamundaTaskListClient createTasklistClient() throws MalformedURLException
6670
boolean returnVariables = false;
6771
boolean loadTruncatedVariables = false;
6872
boolean useZeebeUserTasks = true;
69-
// if you are using zeebe user tasks, you require a zeebe client as well
70-
ZeebeClient zeebeClient = zeebeClient();
73+
// if you are using camunda user tasks, you require a camunda client as well
74+
CamundaClient camundaClient = camundaClient();
7175
// bootstrapping
7276
JwtCredential credentials =
7377
new JwtCredential(clientId, clientSecret, audience, authUrl, scope);
@@ -77,9 +81,10 @@ public CamundaTaskListClient createTasklistClient() throws MalformedURLException
7781
JwtAuthentication authentication = new JwtAuthentication(credentials, clientResponseHandler);
7882
CamundaTasklistClientConfiguration configuration =
7983
new CamundaTasklistClientConfiguration(
84+
apiVersion,
8085
authentication,
8186
tasklistUrl,
82-
zeebeClient,
87+
camundaClient,
8388
new DefaultProperties(returnVariables, loadTruncatedVariables, useZeebeUserTasks));
8489
CamundaTaskListClient client = new CamundaTaskListClient(configuration);
8590
return client;
@@ -90,15 +95,16 @@ class SaasTasklistClientBootstrapper implements TasklistClientBootstrapper {
9095
@Override
9196
public CamundaTaskListClient createTasklistClient() throws MalformedURLException {
9297
// properties you need to provide
98+
ApiVersion apiVersion = ApiVersion.v1;
9399
String region = "";
94100
String clusterId = "";
95101
String clientId = "";
96102
String clientSecret = "";
97103
boolean returnVariables = false;
98104
boolean loadTruncatedVariables = false;
99105
boolean useZeebeUserTasks = true;
100-
// if you are using zeebe user tasks, you require a zeebe client as well
101-
ZeebeClient zeebeClient = zeebeClient();
106+
// if you are using camunda user tasks, you require a camunda client as well
107+
CamundaClient camundaClient = camundaClient();
102108
// bootstrapping
103109
URL tasklistUrl =
104110
URI.create("https://" + region + ".tasklist.camunda.io/" + clusterId).toURL();
@@ -111,9 +117,10 @@ public CamundaTaskListClient createTasklistClient() throws MalformedURLException
111117
JwtAuthentication authentication = new JwtAuthentication(credentials, clientResponseHandler);
112118
CamundaTasklistClientConfiguration configuration =
113119
new CamundaTasklistClientConfiguration(
120+
apiVersion,
114121
authentication,
115122
tasklistUrl,
116-
zeebeClient,
123+
camundaClient,
117124
new DefaultProperties(returnVariables, loadTruncatedVariables, useZeebeUserTasks));
118125
CamundaTaskListClient client = new CamundaTaskListClient(configuration);
119126
return client;

extension/client-java/pom.xml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,37 +22,31 @@
2222
</dependency>
2323
<dependency>
2424
<groupId>io.camunda</groupId>
25-
<artifactId>zeebe-client-java</artifactId>
25+
<artifactId>camunda-client-java</artifactId>
2626
</dependency>
2727
<dependency>
2828
<groupId>com.fasterxml.jackson.datatype</groupId>
2929
<artifactId>jackson-datatype-jsr310</artifactId>
30-
<scope>provided</scope>
3130
</dependency>
3231
<dependency>
3332
<groupId>com.fasterxml.jackson.core</groupId>
3433
<artifactId>jackson-databind</artifactId>
35-
<scope>provided</scope>
3634
</dependency>
3735
<dependency>
3836
<groupId>com.fasterxml.jackson.core</groupId>
3937
<artifactId>jackson-core</artifactId>
40-
<scope>provided</scope>
4138
</dependency>
4239
<dependency>
4340
<groupId>com.fasterxml.jackson.core</groupId>
4441
<artifactId>jackson-annotations</artifactId>
45-
<scope>provided</scope>
4642
</dependency>
4743
<dependency>
4844
<groupId>org.apache.httpcomponents.core5</groupId>
4945
<artifactId>httpcore5</artifactId>
50-
<scope>provided</scope>
5146
</dependency>
5247
<dependency>
5348
<groupId>org.apache.httpcomponents.client5</groupId>
5449
<artifactId>httpclient5</artifactId>
55-
<scope>provided</scope>
5650
</dependency>
5751
<dependency>
5852
<groupId>org.junit.jupiter</groupId>

0 commit comments

Comments
 (0)