public boolean isJobIncident(IncidentRecord record) { return record.getJobKey() > 0; }
public boolean isJobIncident(IncidentRecord record) { return record.getJobKey() > 0; }
private void attemptToResolveIncident( TypedResponseWriter responseWriter, TypedStreamWriter streamWriter, Consumer<SideEffectProducer> sideEffect, IncidentRecord incidentRecord) { final long jobKey = incidentRecord.getJobKey(); final boolean isJobIncident = jobKey > 0; if (isJobIncident) { attemptToMakeJobActivatableAgain(jobKey); } else { attemptToContinueWorkflowProcessing(responseWriter, streamWriter, sideEffect, incidentRecord); } }
private void attemptToResolveIncident( TypedResponseWriter responseWriter, TypedStreamWriter streamWriter, Consumer<SideEffectProducer> sideEffect, IncidentRecord incidentRecord) { final long jobKey = incidentRecord.getJobKey(); final boolean isJobIncident = jobKey > 0; if (isJobIncident) { attemptToMakeJobActivatableAgain(jobKey); } else { attemptToContinueWorkflowProcessing(responseWriter, streamWriter, sideEffect, incidentRecord); } }
@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()); assertThat(readRecord.getJobKey()).isEqualTo(1234); assertThat(writtenRecord.getJobKey()).isEqualTo(2048); }
@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()); assertThat(readRecord.getJobKey()).isEqualTo(1234); assertThat(writtenRecord.getJobKey()).isEqualTo(2048); }
public void assertIncident( final IncidentRecord expectedRecord, final IncidentRecord storedRecord) { assertThat(expectedRecord.getJobKey()).isEqualTo(storedRecord.getJobKey()); assertThat(expectedRecord.getElementInstanceKey()) .isEqualTo(storedRecord.getElementInstanceKey()); assertThat(expectedRecord.getBpmnProcessId()).isEqualTo(storedRecord.getBpmnProcessId()); assertThat(expectedRecord.getElementId()).isEqualTo(storedRecord.getElementId()); assertThat(expectedRecord.getErrorMessage()).isEqualTo(storedRecord.getErrorMessage()); assertThat(expectedRecord.getErrorType()).isEqualTo(storedRecord.getErrorType()); } }
public boolean rejectIncidentCreation( IncidentRecord incidentEvent, CommandControl<IncidentRecord> commandControl) { final IncidentState incidentState = zeebeState.getIncidentState(); final boolean isJobIncident = incidentState.isJobIncident(incidentEvent); if (isJobIncident) { return rejectJobIncident(incidentEvent.getJobKey(), commandControl); } else { return rejectWorkflowInstanceIncident(incidentEvent.getElementInstanceKey(), commandControl); } }
public boolean rejectIncidentCreation( IncidentRecord incidentEvent, CommandControl<IncidentRecord> commandControl) { final IncidentState incidentState = zeebeState.getIncidentState(); final boolean isJobIncident = incidentState.isJobIncident(incidentEvent); if (isJobIncident) { return rejectJobIncident(incidentEvent.getJobKey(), commandControl); } else { return rejectWorkflowInstanceIncident(incidentEvent.getElementInstanceKey(), commandControl); } }
public void assertIncident( final IncidentRecord expectedRecord, final IncidentRecord storedRecord) { assertThat(expectedRecord.getJobKey()).isEqualTo(storedRecord.getJobKey()); assertThat(expectedRecord.getElementInstanceKey()) .isEqualTo(storedRecord.getElementInstanceKey()); assertThat(expectedRecord.getBpmnProcessId()).isEqualTo(storedRecord.getBpmnProcessId()); assertThat(expectedRecord.getElementId()).isEqualTo(storedRecord.getElementId()); assertThat(expectedRecord.getErrorMessage()).isEqualTo(storedRecord.getErrorMessage()); assertThat(expectedRecord.getErrorType()).isEqualTo(storedRecord.getErrorType()); } }
public void deleteIncident(long key) { final IncidentRecord incidentRecord = getIncidentRecord(key); if (incidentRecord != null) { zeebeDb.batch( () -> { incidentColumnFamily.delete(incidentKey); if (isJobIncident(incidentRecord)) { jobKey.wrapLong(incidentRecord.getJobKey()); jobIncidentColumnFamily.delete(jobKey); } else { elementInstanceKey.wrapLong(incidentRecord.getElementInstanceKey()); workflowInstanceIncidentColumnFamily.delete(elementInstanceKey); } }); } }
public void deleteIncident(long key) { final IncidentRecord incidentRecord = getIncidentRecord(key); if (incidentRecord != null) { zeebeDb.batch( () -> { incidentColumnFamily.delete(incidentKey); if (isJobIncident(incidentRecord)) { jobKey.wrapLong(incidentRecord.getJobKey()); jobIncidentColumnFamily.delete(jobKey); } else { elementInstanceKey.wrapLong(incidentRecord.getElementInstanceKey()); workflowInstanceIncidentColumnFamily.delete(elementInstanceKey); } }); } }
public void createIncident(long incidentKey, IncidentRecord incident) { zeebeDb.batch( () -> { this.incidentKey.wrapLong(incidentKey); this.incidentRecordToWrite.wrapObject(incident); incidentColumnFamily.put(this.incidentKey, this.incidentRecordToWrite); if (isJobIncident(incident)) { jobKey.wrapLong(incident.getJobKey()); jobIncidentColumnFamily.put(jobKey, this.incidentKey); } else { elementInstanceKey.wrapLong(incident.getElementInstanceKey()); workflowInstanceIncidentColumnFamily.put(elementInstanceKey, this.incidentKey); } }); }
public void createIncident(long incidentKey, IncidentRecord incident) { zeebeDb.batch( () -> { this.incidentKey.wrapLong(incidentKey); this.incidentRecordToWrite.wrapObject(incident); incidentColumnFamily.put(this.incidentKey, this.incidentRecordToWrite); if (isJobIncident(incident)) { jobKey.wrapLong(incident.getJobKey()); jobIncidentColumnFamily.put(jobKey, this.incidentKey); } else { elementInstanceKey.wrapLong(incident.getElementInstanceKey()); workflowInstanceIncidentColumnFamily.put(elementInstanceKey, this.incidentKey); } }); }
private IncidentRecordValue ofIncidentRecord(final LoggedEvent event) { final IncidentRecord record = new IncidentRecord(); event.readValue(record); return new IncidentRecordValueImpl( objectMapper, record.getErrorType().name(), asString(record.getErrorMessage()), asString(record.getBpmnProcessId()), asString(record.getElementId()), record.getWorkflowInstanceKey(), record.getElementInstanceKey(), record.getJobKey()); }
private IncidentRecordValue ofIncidentRecord(final LoggedEvent event) { final IncidentRecord record = new IncidentRecord(); event.readValue(record); return new IncidentRecordValueImpl( objectMapper, record.getErrorType().name(), asString(record.getErrorMessage()), asString(record.getBpmnProcessId()), asString(record.getElementId()), record.getWorkflowInstanceKey(), record.getElementInstanceKey(), record.getJobKey(), record.getVariableScopeKey()); }