use of io.camunda.zeebe.client.ZeebeClientBuilder in project zeebe by camunda.
the class GrpcClientRule method before.
@Override
public void before() {
startTime = System.currentTimeMillis();
final ZeebeClientBuilder builder = ZeebeClient.newClientBuilder().defaultRequestTimeout(Duration.ofSeconds(10));
configurator.accept(builder);
client = builder.build();
LOG.info("\n====\nClient startup time: {}\n====\n", (System.currentTimeMillis() - startTime));
startTime = System.currentTimeMillis();
}
use of io.camunda.zeebe.client.ZeebeClientBuilder in project zeebe by zeebe-io.
the class GrpcClientRule method before.
@Override
public void before() {
startTime = System.currentTimeMillis();
final ZeebeClientBuilder builder = ZeebeClient.newClientBuilder().defaultRequestTimeout(Duration.ofSeconds(10));
configurator.accept(builder);
client = builder.build();
LOG.info("\n====\nClient startup time: {}\n====\n", (System.currentTimeMillis() - startTime));
startTime = System.currentTimeMillis();
}
use of io.camunda.zeebe.client.ZeebeClientBuilder in project zeebe by zeebe-io.
the class TopologyViewer method main.
public static void main(final String[] args) {
final String defaultAddress = "localhost:26500";
final String envVarAddress = System.getenv("ZEEBE_ADDRESS");
final ZeebeClientBuilder clientBuilder;
final String contactPoint;
if (envVarAddress != null) {
/* Connect to Camunda Cloud Cluster, assumes that credentials are set in environment variables.
* See JavaDoc on class level for details
*/
contactPoint = envVarAddress;
clientBuilder = ZeebeClient.newClientBuilder().gatewayAddress(envVarAddress);
} else {
// connect to local deployment; assumes that authentication is disabled
contactPoint = defaultAddress;
clientBuilder = ZeebeClient.newClientBuilder().gatewayAddress(defaultAddress).usePlaintext();
}
try (final ZeebeClient client = clientBuilder.build()) {
System.out.println("Requesting topology with initial contact point " + contactPoint);
final Topology topology = client.newTopologyRequest().send().join();
System.out.println("Topology:");
topology.getBrokers().forEach(b -> {
System.out.println(" " + b.getAddress());
b.getPartitions().forEach(p -> System.out.println(" " + p.getPartitionId() + " - " + p.getRole()));
});
System.out.println("Done.");
}
}
use of io.camunda.zeebe.client.ZeebeClientBuilder in project zeebe by zeebe-io.
the class JobWorkerCreator method main.
public static void main(final String[] args) {
final String defaultAddress = "localhost:26500";
final String envVarAddress = System.getenv("ZEEBE_ADDRESS");
final ZeebeClientBuilder clientBuilder;
if (envVarAddress != null) {
/* Connect to Camunda Cloud Cluster, assumes that credentials are set in environment variables.
* See JavaDoc on class level for details
*/
clientBuilder = ZeebeClient.newClientBuilder().gatewayAddress(envVarAddress);
} else {
// connect to local deployment; assumes that authentication is disabled
clientBuilder = ZeebeClient.newClientBuilder().gatewayAddress(defaultAddress).usePlaintext();
}
final String jobType = "foo";
try (final ZeebeClient client = clientBuilder.build()) {
System.out.println("Opening job worker.");
try (final JobWorker workerRegistration = client.newWorker().jobType(jobType).handler(new ExampleJobHandler()).timeout(Duration.ofSeconds(10)).open()) {
System.out.println("Job worker opened and receiving jobs.");
// run until System.in receives exit command
waitUntilSystemInput("exit");
}
}
}
use of io.camunda.zeebe.client.ZeebeClientBuilder in project zeebe by zeebe-io.
the class ProcessDeployer method main.
public static void main(final String[] args) {
final String defaultAddress = "localhost:26500";
final String envVarAddress = System.getenv("ZEEBE_ADDRESS");
final ZeebeClientBuilder clientBuilder;
if (envVarAddress != null) {
/* Connect to Camunda Cloud Cluster, assumes that credentials are set in environment variables.
* See JavaDoc on class level for details
*/
clientBuilder = ZeebeClient.newClientBuilder().gatewayAddress(envVarAddress);
} else {
// connect to local deployment; assumes that authentication is disabled
clientBuilder = ZeebeClient.newClientBuilder().gatewayAddress(defaultAddress).usePlaintext();
}
try (final ZeebeClient client = clientBuilder.build()) {
final DeploymentEvent deploymentEvent = client.newDeployResourceCommand().addResourceFromClasspath("demoProcess.bpmn").send().join();
System.out.println("Deployment created with key: " + deploymentEvent.getKey());
}
}
Aggregations