@nathan.loding Thanks again, for a quick and detailed reply. Here’s what I have found out, armed with your explanation, the links to gRPC docs and a bit of exploration on my part.
In the XML file (“./diagram_6.bpmn”), , the process-id tag is <bpmn:process id="process-payments-6-NS"
.
Given this workflow, the following code snippet
var zeebeDeploymentReport = zeebeClient
.newDeployResourceCommand()
.addResourceFile(wfToDeploy.wfDefinitionFilePath())
.send()
.join();
provides the following info.
- The Deployment Key is
Long
value; in my case 2251799814356918. From the gRPC Protobuf definition, this is supposed to represent // the unique key identifying the deployment
. Got it.
- The Tenant ID is just
<default>
; no idea why! In a self-managed set up, where there is no other tenant, it should say something like ‘Are you lonesome?’ and may be, put a hand on my shoulder!
- The number of processes is 1. Perfect!
That single process carries more information, such as:
-
The bpmnProcessId
(refer to the Javadoc in my earlier response) is as expected: process-payments-6-NS. No surprises! From the gRPC Protobuf definition, this is supposed to represent // the bpmn process ID, as parsed during deployment; together with the version forms a unique identifier for a specific process definition
.
-
The resourceName
is the name of the file: ./diagram_6.bpmn
.
-
The version
is 7. This is so, because I have been experimenting and thus, a number of versions have been created. Before executing the code shown above, I have meticulously removed the preceding 6 versions, using ‘operate’ web console.
-
The processDefinitionKey
is Long
value; in my case 2251799814326464.
From the gRPC Protobuf definition, this is supposed to represent // the assigned key, which acts as a unique identifier for this process
. Importantly, this value is not the same as the ‘Deployment Key’ above.
[Note]: From your reply above, I understand that the ‘bpmnProcessId + version’ combo is equivalent to the ‘processDefinitionKey’.
-
The tenantdId
is, well, <default>
. I mean, why, Zeebe, why? Don’t you know me?
With everything being set, the following code snippet, creates an instance of the workflow:
var zeebeCreatedInstanceReport =
zeebeClient
.newCreateInstanceCommand()
.processDefinitionKey(
zeebeDeploymentReport
.getProcesses().get(0)
.getProcessDefinitionKey()
)
//.bpmnProcessId(zeebeDeploymentReport.getProcesses().get(0).getBpmnProcessId())
// .latestVersion()
.send()
.join();
[Note]: Watch the commented two lines above.
The following info are available:
- processDefnitionKey is 2251799814326464, the same as reported after the deployment. No surprise.
- bpmnProcessID is process-payments-6-NS, the same as reported after the deployment. No surprise.
- resourceName and version are the same as reported before, as well.
- tenantID is, you guessed it, !
- processInstanceKey is 2251799814356919. This is important, of course. From the gRPC Protobuf definition, this is supposed to represent
// the unique identifier of the created process instance; to be used wherever a request needs a process instance key (e.g. CancelProcessInstanceRequest)
.
At this point, I have checked the state of Camunda 8 Workflow engine through ‘operate’ web console. Indeed, a workflow has been deployed and an instance of it, created and running.
Then, I run the following:
var z = zeebeClient
.newCancelInstanceCommand(
zeebeCreatedInstanceReport.getProcessInstanceKey()
)
.send()
.join();
The return value is an object, carrying no useful information. It is impossible to know, programmatically, if the cancellation has gone through or not. When I check at ‘operate’ web console, the state of the process instance is not always ‘cancelled’. It may be because of some delay, but it is not predictable from what I have seen so far.
Further, I have tried this:
var y =
zeebeClient
.newDeleteResourceCommand(
// Remember, that Key that was returned
// when the deployment was successful?
zeebeDeploymentReport.getKey())
.send()
.join();
This throws as exception:
NOT_FOUND: Command 'DELETE' rejected with code 'NOT_FOUND': Expected to delete resource but no resource found with key `2251799814370438`
This is what gRPC Prortobuf definition says:
message DeleteResourceRequest {
// The key of the resource that should be deleted. This can either be the key
// of a process definition, the key of a decision requirements definition or the key of a form.
int64 resourceKey = 1;
}
So, it is not clear at all, of what use that key is (even though it is mentioned in the gRPC Protobuf description file)?
Out of curiosity, I have tried the following, because the name processDefinitionKey
suggests that this may be appropriate:
var y =
zeebeClient
.newDeleteResourceCommand(
// This is processDefinitionKey and *not* the processInstanceKey
zeebeCreatedInstanceReport.getProcessDefinitionKey()
)
.send()
.join();
The return value is an object, carrying no useful information. So, It is impossible to know, programmatically, if the deletion of the resource has gone through or not. When I check at ‘operate’ web console, the workflow deployed is still shown to be present!!
This is long, I know. I hope you will have the patience to read through it all. I have tried to give as much information as possible. I hope it is useful. Thanks for coaxing me.
Please guide me, for the next steps.