use of io.camunda.zeebe.protocol.impl.record.value.incident.IncidentRecord in project zeebe-process-test by camunda.
the class GrpcToLogStreamGateway method resolveIncident.
@Override
public void resolveIncident(final ResolveIncidentRequest request, final StreamObserver<ResolveIncidentResponse> responseObserver) {
executor.submit(() -> {
final Long requestId = registerNewRequest(responseObserver);
prepareRecordMetadata().requestId(requestId).valueType(ValueType.INCIDENT).intent(IncidentIntent.RESOLVE);
final IncidentRecord incidentRecord = new IncidentRecord();
writeCommandWithKey(request.getIncidentKey(), recordMetadata, incidentRecord);
});
}
use of io.camunda.zeebe.protocol.impl.record.value.incident.IncidentRecord in project zeebe by camunda.
the class JobBatchActivateProcessor method raiseIncidentJobTooLargeForMessageSize.
private void raiseIncidentJobTooLargeForMessageSize(final long jobKey, final JobRecord job) {
final String messageSize = ByteValue.prettyPrint(stateWriter.getMaxEventLength());
final DirectBuffer incidentMessage = wrapString(String.format("The job with key '%s' can not be activated because it is larger than the configured message size (%s). " + "Try to reduce the size by reducing the number of fetched variables or modifying the variable values.", jobKey, messageSize));
final var incidentEvent = new IncidentRecord().setErrorType(ErrorType.MESSAGE_SIZE_EXCEEDED).setErrorMessage(incidentMessage).setBpmnProcessId(job.getBpmnProcessIdBuffer()).setProcessDefinitionKey(job.getProcessDefinitionKey()).setProcessInstanceKey(job.getProcessInstanceKey()).setElementId(job.getElementIdBuffer()).setElementInstanceKey(job.getElementInstanceKey()).setJobKey(jobKey).setVariableScopeKey(job.getElementInstanceKey());
stateWriter.appendFollowUpEvent(keyGenerator.nextKey(), IncidentIntent.CREATED, incidentEvent);
}
use of io.camunda.zeebe.protocol.impl.record.value.incident.IncidentRecord in project zeebe by camunda.
the class ExporterDirectorTest method shouldApplyRecordFilter.
@Test
public void shouldApplyRecordFilter() {
// given
exporters.get(0).onConfigure(withFilter(Arrays.asList(RecordType.COMMAND, RecordType.EVENT), Collections.singletonList(ValueType.DEPLOYMENT)));
exporters.get(1).onConfigure(withFilter(Collections.singletonList(RecordType.EVENT), Arrays.asList(ValueType.DEPLOYMENT, ValueType.JOB)));
startExporterDirector(exporterDescriptors);
// when
final long deploymentCommand = rule.writeCommand(DeploymentIntent.CREATE, new DeploymentRecord());
final long deploymentEvent = rule.writeEvent(DeploymentIntent.CREATED, new DeploymentRecord());
rule.writeEvent(IncidentIntent.CREATED, new IncidentRecord());
final long jobEvent = rule.writeEvent(JobIntent.CREATED, new JobRecord());
// then
waitUntil(() -> exporters.get(1).getExportedRecords().size() == 2);
assertThat(exporters.get(0).getExportedRecords()).extracting(Record::getPosition).hasSize(2).contains(deploymentCommand, deploymentEvent);
assertThat(exporters.get(1).getExportedRecords()).extracting(Record::getPosition).hasSize(2).contains(deploymentEvent, jobEvent);
}
use of io.camunda.zeebe.protocol.impl.record.value.incident.IncidentRecord in project zeebe by camunda.
the class DbIncidentState method forExistingProcessIncident.
@Override
public void forExistingProcessIncident(final long elementInstanceKey, final ObjLongConsumer<IncidentRecord> resolver) {
final long processIncidentKey = getProcessInstanceIncidentKey(elementInstanceKey);
final boolean hasIncident = processIncidentKey != IncidentState.MISSING_INCIDENT;
if (hasIncident) {
final IncidentRecord incidentRecord = getIncidentRecord(processIncidentKey);
resolver.accept(incidentRecord, processIncidentKey);
}
}
use of io.camunda.zeebe.protocol.impl.record.value.incident.IncidentRecord in project zeebe by camunda.
the class IncidentStateTest method shouldNotOverwritePreviousRecord.
@Test
public void shouldNotOverwritePreviousRecord() {
// given
final long key = 1L;
final IncidentRecord writtenRecord = createJobIncident();
// when
incidentState.createIncident(key, writtenRecord);
writtenRecord.setJobKey(2048);
// then
final IncidentRecord readRecord = incidentState.getIncidentRecord(1L);
assertThat(readRecord.getJobKey()).isNotEqualTo(writtenRecord.getJobKey()).isEqualTo(1234);
assertThat(writtenRecord.getJobKey()).isEqualTo(2048);
}
Aggregations