Skip to content

Commit

Permalink
Create README.md with a few examples
Browse files Browse the repository at this point in the history
(cherry picked from commit 232cc80)
  • Loading branch information
chDame authored and 1nb0und committed Dec 25, 2023
1 parent 4f0f91b commit 39dcd34
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions camunda-sdk-java/java-client-operate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Java Operate client

## Build the client

### SaaS Authentication

```java
JwtConfig jwtConfig = new JwtConfig();
jwtConfig.addProduct(Product.OPERATE, new JwtCredential(clientId, clientSecret));
targetOperateUrl = "https://" + region + ".operate.camunda.io/" + clusterId;
auth = SaaSAuthentication.builder().jwtConfig(jwtConfig).build();

client = CamundaOperateClient.builder()
.operateUrl(targetOperateUrl)
.authentication(auth)
.setup()
.build();
```

### SelfManaged Authentication

```java
JwtConfig jwtConfig = new JwtConfig();
jwtConfig.addProduct(Product.OPERATE, new JwtCredential(clientId, clientSecret));
auth = SelfManagedAuthentication.builder().jwtConfig(jwtConfig).keycloakUrl(keycloakUrl).build();

client = CamundaOperateClient.builder()
.operateUrl(operateUrl)
.authentication(auth)
.setup()
.build();
```

## Use the client

### List deployed process definitions

```java
ProcessDefinitionFilter processDefinitionFilter = ProcessDefinitionFilter.builder().build();
SearchQuery procDefQuery = new SearchQuery.Builder()
.filter(processDefinitionFilter)
.size(1000)
.sort(new Sort("version", SortOrder.DESC))
.build();
return camundaOperateClient.searchProcessDefinitions(procDefQuery);
```

### Read process definitions content

```java
camundaOperateClient.getProcessDefinitionXml(ProcessDefinitionKey);
```

### List variables

```java
return camundaOperateClient.searchVariables(new SearchQuery.Builder().filter(new VariableFilter()).size(100).build());
```

0 comments on commit 39dcd34

Please sign in to comment.