public class ZeebeClientImpl extends Object implements ZeebeClient
Constructor and Description |
---|
ZeebeClientImpl(ZeebeClientConfiguration configuration) |
ZeebeClientImpl(ZeebeClientConfiguration configuration,
io.grpc.ManagedChannel channel) |
ZeebeClientImpl(ZeebeClientConfiguration config,
io.grpc.ManagedChannel channel,
ScheduledExecutorService executorService) |
Modifier and Type | Method and Description |
---|---|
static io.grpc.ManagedChannel |
buildChannel(ZeebeClientConfiguration config) |
void |
close() |
ZeebeClientConfiguration |
getConfiguration() |
ActivateJobsCommandStep1 |
newActivateJobsCommand()
Command to activate multiple jobs of a given type.
|
CancelWorkflowInstanceCommandStep1 |
newCancelInstanceCommand(long workflowInstanceKey)
Command to cancel a workflow instance.
|
CompleteJobCommandStep1 |
newCompleteCommand(long jobKey)
Command to complete a job.
|
CreateWorkflowInstanceCommandStep1 |
newCreateInstanceCommand()
Command to create/start a new instance of a workflow.
|
DeployWorkflowCommandStep1 |
newDeployCommand()
Command to deploy new workflows.
|
FailJobCommandStep1 |
newFailCommand(long jobKey)
Command to mark a job as failed.
|
PublishMessageCommandStep1 |
newPublishMessageCommand()
Command to publish a message which can be correlated to a workflow instance.
|
ResolveIncidentCommandStep1 |
newResolveIncidentCommand(long incidentKey)
Command to resolve an existing incident.
|
WorkflowResourceRequestStep1 |
newResourceRequest()
Request to get the resource of a workflow (i.e.
|
TopologyRequestStep1 |
newTopologyRequest()
Request the current cluster topology.
|
UpdatePayloadWorkflowInstanceCommandStep1 |
newUpdatePayloadCommand(long elementInstanceKey)
Command to update the payload of a workflow instance.
|
UpdateRetriesJobCommandStep1 |
newUpdateRetriesCommand(long jobKey)
Command to update the retries of a job.
|
JobWorkerBuilderStep1 |
newWorker()
Registers a new job worker for jobs of a given type.
|
WorkflowRequestStep1 |
newWorkflowRequest()
Request to get all deployed workflows.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
newClient, newClient, newClientBuilder
public ZeebeClientImpl(ZeebeClientConfiguration configuration)
public ZeebeClientImpl(ZeebeClientConfiguration configuration, io.grpc.ManagedChannel channel)
public ZeebeClientImpl(ZeebeClientConfiguration config, io.grpc.ManagedChannel channel, ScheduledExecutorService executorService)
public static io.grpc.ManagedChannel buildChannel(ZeebeClientConfiguration config)
public TopologyRequestStep1 newTopologyRequest()
ZeebeClient
List<BrokerInfo> brokers = zeebeClient .newTopologyRequest() .send() .join() .getBrokers(); SocketAddress address = broker.getSocketAddress(); List<PartitionInfo> partitions = broker.getPartitions();
newTopologyRequest
in interface ZeebeClient
send()
public ZeebeClientConfiguration getConfiguration()
getConfiguration
in interface ZeebeClient
public void close()
close
in interface ZeebeClient
close
in interface AutoCloseable
public DeployWorkflowCommandStep1 newDeployCommand()
ZeebeClient
zeebeClient .newDeployCommand() .addResourceFile("~/wf/workflow1.bpmn") .addResourceFile("~/wf/workflow2.bpmn") .send();
newDeployCommand
in interface ZeebeClient
public CreateWorkflowInstanceCommandStep1 newCreateInstanceCommand()
ZeebeClient
zeebeClient .newCreateInstanceCommand() .bpmnProcessId("my-process") .latestVersion() .payload(json) .send();
newCreateInstanceCommand
in interface ZeebeClient
public CancelWorkflowInstanceCommandStep1 newCancelInstanceCommand(long workflowInstanceKey)
ZeebeClient
zeebeClient .newCancelInstanceCommand(workflowInstanceKey) .send();
newCancelInstanceCommand
in interface ZeebeClient
workflowInstanceKey
- the key which identifies the corresponding workflow instancepublic UpdatePayloadWorkflowInstanceCommandStep1 newUpdatePayloadCommand(long elementInstanceKey)
ZeebeClient
zeebeClient .newUpdatePayloadCommand(elementInstanceKey) .payload(json) .send();
newUpdatePayloadCommand
in interface ZeebeClient
elementInstanceKey
- the key of the element instance to update the payload forpublic PublishMessageCommandStep1 newPublishMessageCommand()
ZeebeClient
zeebeClient .newPublishMessageCommand() .messageName("order canceled") .correlationKey(orderId) .payload(json) .send();
newPublishMessageCommand
in interface ZeebeClient
public WorkflowResourceRequestStep1 newResourceRequest()
ZeebeClient
WorkflowResource resource = zeebeClient .newResourceRequest() .bpmnProcessId("my-process") .lastestVersion() .send() .join(); String bpmnXml = resoure.getBpmnXml();
newResourceRequest
in interface ZeebeClient
public WorkflowRequestStep1 newWorkflowRequest()
ZeebeClient
List<Workflow> workflows = zeebeClient .newWorkflowRequest() .send() .join() .getWorkflows(); String bpmnProcessId = workflow.getBpmnProcessId();The response does not contain the resources of the workflows. Use
ZeebeClient.newResourceRequest()
to get the resource of a workflow.newWorkflowRequest
in interface ZeebeClient
ZeebeClient.newResourceRequest()
public ResolveIncidentCommandStep1 newResolveIncidentCommand(long incidentKey)
ZeebeClient
zeebeClient .newResolveIncidentCommand(incidentKey) .send();
newResolveIncidentCommand
in interface ZeebeClient
incidentKey
- the key of the corresponding incidentpublic UpdateRetriesJobCommandStep1 newUpdateRetriesCommand(long jobKey)
ZeebeClient
long jobKey = ..; zeebeClient .newUpdateRetriesCommand(jobKey) .retries(3) .send();
If the given retries are greater than zero then this job will be picked up again by a job subscription and a related incident will be marked as resolved.
newUpdateRetriesCommand
in interface ZeebeClient
jobKey
- the key of the job to updatepublic JobWorkerBuilderStep1 newWorker()
ZeebeClient
After registration, the broker activates available jobs and assigns them to this worker. It then publishes them to the client. The given worker is called for every received job, works on them and eventually completes them.
JobWorker worker = zeebeClient .newWorker() .jobType("payment") .handler(paymentHandler) .open(); ... worker.close();Example JobHandler implementation:
public class PaymentHandler implements JobHandler { @Override public void handle(JobClient client, JobEvent jobEvent) { String json = jobEvent.getPayload(); // modify payload client .newCompleteCommand() .event(jobEvent) .payload(json) .send(); } };
newWorker
in interface ZeebeClient
public ActivateJobsCommandStep1 newActivateJobsCommand()
ZeebeClient
zeebeClient .newActivateJobsCommand() .jobType("payment") .amount(10) .workerName("paymentWorker") .timeout(Duration.ofMinutes(10)) .send();
The command will try to activate maximal amount
jobs of given jobType
. If
less then amount
jobs of the jobType
are available for activation the returned
list will have fewer elements.
newActivateJobsCommand
in interface ZeebeClient
public CompleteJobCommandStep1 newCompleteCommand(long jobKey)
JobClient
long jobKey = ..; jobClient .newCompleteCommand(jobKey) .payload(json) .send();
If the job is linked to a workflow instance then this command will complete the related activity and continue the flow.
newCompleteCommand
in interface JobClient
jobKey
- the key which identifies the jobpublic FailJobCommandStep1 newFailCommand(long jobKey)
JobClient
long jobKey = ..; jobClient .newFailCommand(jobKey) .retries(3) .send();
If the given retries are greater than zero then this job will be picked up again by a job subscription. Otherwise, an incident is created for this job.
newFailCommand
in interface JobClient
jobKey
- the key which identifies the jobCopyright © 2017–2019 camunda services GmbH. All rights reserved.