use of io.camunda.zeebe.protocol.impl.record.value.processinstance.ProcessInstanceCreationRecord in project zeebe by camunda.
the class UniqueKeyFormatTest method shouldStartProcessInstanceAtNoneStartEvent.
// todo: this does not need to be an integration test if the only test is that the partitionId is
// encoded in the key
@Test
public void shouldStartProcessInstanceAtNoneStartEvent() {
// given
apiRule.partitionClient().deploy(Bpmn.createExecutableProcess("process").startEvent("foo").endEvent().done());
// when
TestUtil.waitUntil(() -> RecordingExporter.deploymentRecords().withPartitionId(2).exists());
final ProcessInstanceCreationRecord processInstanceWithResponse = apiRule.partitionClient(2).createProcessInstance(r -> r.setBpmnProcessId("process"));
// then partition id is encoded in the returned getKey
final long key = processInstanceWithResponse.getProcessInstanceKey();
final int partitionId = Protocol.decodePartitionId(key);
assertThat(partitionId).isEqualTo(2);
}
use of io.camunda.zeebe.protocol.impl.record.value.processinstance.ProcessInstanceCreationRecord in project zeebe by camunda.
the class ClusteringRule method createProcessInstanceOnPartition.
public long createProcessInstanceOnPartition(final int partitionId, final String bpmnProcessId) {
final BrokerCreateProcessInstanceRequest request = new BrokerCreateProcessInstanceRequest().setBpmnProcessId(bpmnProcessId);
request.setPartitionId(partitionId);
final BrokerResponse<ProcessInstanceCreationRecord> response = gateway.getBrokerClient().sendRequestWithRetry(request).join();
if (response.isResponse()) {
return response.getResponse().getProcessInstanceKey();
} else {
throw new RuntimeException("Failed to create process instance for bpmn process id " + bpmnProcessId + " on partition with id " + partitionId + ": " + response);
}
}
use of io.camunda.zeebe.protocol.impl.record.value.processinstance.ProcessInstanceCreationRecord in project zeebe by camunda.
the class PartitionTestClient method createProcessInstance.
public ProcessInstanceCreationRecord createProcessInstance(final ProcessInstanceCreationRecord record) {
final ExecuteCommandResponse response = executeCommandRequest(ValueType.PROCESS_INSTANCE_CREATION, ProcessInstanceCreationIntent.CREATE, record);
assertThat(response.getRecordType()).isEqualTo(RecordType.EVENT);
assertThat(response.getIntent()).isEqualTo(ProcessInstanceCreationIntent.CREATED);
return response.readInto(new ProcessInstanceCreationRecord());
}
use of io.camunda.zeebe.protocol.impl.record.value.processinstance.ProcessInstanceCreationRecord in project zeebe-process-test by camunda-cloud.
the class GrpcToLogStreamGateway method createProcessInstanceWithResult.
@Override
public void createProcessInstanceWithResult(final CreateProcessInstanceWithResultRequest request, final StreamObserver<CreateProcessInstanceWithResultResponse> responseObserver) {
final Long requestId = gatewayRequestStore.registerNewRequest(request.getClass(), responseObserver);
final RecordMetadata recordMetadata = prepareRecordMetadata().requestId(requestId).valueType(ValueType.PROCESS_INSTANCE_CREATION).intent(ProcessInstanceCreationIntent.CREATE_WITH_AWAITING_RESULT);
final ProcessInstanceCreationRecord processInstanceCreationRecord = createProcessInstanceCreationRecord(request.getRequest());
processInstanceCreationRecord.setFetchVariables(request.getFetchVariablesList());
writer.writeCommandWithoutKey(processInstanceCreationRecord, recordMetadata);
}
use of io.camunda.zeebe.protocol.impl.record.value.processinstance.ProcessInstanceCreationRecord in project zeebe-process-test by camunda-cloud.
the class GrpcToLogStreamGateway method createProcessInstanceCreationRecord.
private ProcessInstanceCreationRecord createProcessInstanceCreationRecord(final GatewayOuterClass.CreateProcessInstanceRequest request) {
final ProcessInstanceCreationRecord processInstanceCreationRecord = new ProcessInstanceCreationRecord();
processInstanceCreationRecord.setBpmnProcessId(request.getBpmnProcessId());
processInstanceCreationRecord.setVersion(request.getVersion());
processInstanceCreationRecord.setProcessDefinitionKey(request.getProcessDefinitionKey());
final String variables = request.getVariables();
if (!variables.isEmpty()) {
processInstanceCreationRecord.setVariables(BufferUtil.wrapArray(MsgPackConverter.convertToMsgPack(variables)));
}
return processInstanceCreationRecord;
}
Aggregations