To use the Java client library, declare the following Maven dependency in your project:
If you are using Gradle, declare the following:
Use the latest released version from Maven Central.
In Java code, instantiate the client as follows:
Let's go over this code snippet line by line:
- First we declare a couple of variables to define the connection properties. These values can be taken from the connection info on the Client Credentials page. Note that
clientSecretis only visible when you create the client credentials.
- Next we create the credentials provider for the OAuth protocol. This is needed to authenticate your client.
- Next we create the client passing in the address of the cluster we want to connect to as well as the credentials provider from the step above.
- Finally, we send a test request to verify that the connection was established.
io.zeebe.client.ZeebeClientBuilder for a description of all available configuration properties.
Another, more compact, option is to pass in the connection settings via environment variables:
When you create client credentials in Camunda Cloud you have the option to download a file with the lines above filled out for you.
Given these environment variables, you can instantiate the client as follows:
- Getting started guide - Comprehensive tutorial that covers Zeebe Modeler, Operate and the Java client.
- Logging - Introduction on how to configure logging for Zeebe Client
- Writing tests - Introduction to writing tests that use an embedded version of the workflow engine
- Examples - Collection of specific examples for different use cases