Search in sources :

Example 1 with ProcessInstanceIntent

use of io.camunda.zeebe.protocol.record.intent.ProcessInstanceIntent in project zeebe by camunda.

the class BpmnStreamProcessor method processRecord.

@Override
public void processRecord(final TypedRecord<ProcessInstanceRecord> record, final TypedResponseWriter responseWriter, final TypedStreamWriter streamWriter, final Consumer<SideEffectProducer> sideEffect) {
    // initialize
    sideEffectQueue.clear();
    sideEffect.accept(sideEffectQueue);
    final var intent = (ProcessInstanceIntent) record.getIntent();
    final var recordValue = record.getValue();
    context.init(record.getKey(), recordValue, intent);
    final var bpmnElementType = recordValue.getBpmnElementType();
    final var processor = processors.getProcessor(bpmnElementType);
    final ExecutableFlowElement element = getElement(recordValue, processor);
    stateTransitionGuard.isValidStateTransition(context).ifRightOrLeft(ok -> {
        LOGGER.trace("Process process instance event [context: {}]", context);
        processEvent(intent, processor, element);
    }, violation -> rejectionWriter.appendRejection(record, RejectionType.INVALID_STATE, violation.getMessage()));
}
Also used : ExecutableFlowElement(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElement) ProcessInstanceIntent(io.camunda.zeebe.protocol.record.intent.ProcessInstanceIntent)

Example 2 with ProcessInstanceIntent

use of io.camunda.zeebe.protocol.record.intent.ProcessInstanceIntent in project zeebe by zeebe-io.

the class BpmnStreamProcessor method processRecord.

@Override
public void processRecord(final TypedRecord<ProcessInstanceRecord> record, final TypedResponseWriter responseWriter, final TypedStreamWriter streamWriter, final Consumer<SideEffectProducer> sideEffect) {
    // initialize
    sideEffectQueue.clear();
    sideEffect.accept(sideEffectQueue);
    final var intent = (ProcessInstanceIntent) record.getIntent();
    final var recordValue = record.getValue();
    context.init(record.getKey(), recordValue, intent);
    final var bpmnElementType = recordValue.getBpmnElementType();
    final var processor = processors.getProcessor(bpmnElementType);
    final ExecutableFlowElement element = getElement(recordValue, processor);
    stateTransitionGuard.isValidStateTransition(context).ifRightOrLeft(ok -> {
        LOGGER.trace("Process process instance event [context: {}]", context);
        processEvent(intent, processor, element);
    }, violation -> rejectionWriter.appendRejection(record, RejectionType.INVALID_STATE, violation.getMessage()));
}
Also used : ExecutableFlowElement(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElement) ProcessInstanceIntent(io.camunda.zeebe.protocol.record.intent.ProcessInstanceIntent)

Example 3 with ProcessInstanceIntent

use of io.camunda.zeebe.protocol.record.intent.ProcessInstanceIntent in project zeebe by camunda-cloud.

the class BpmnStreamProcessor method processRecord.

@Override
public void processRecord(final TypedRecord<ProcessInstanceRecord> record, final TypedResponseWriter responseWriter, final TypedStreamWriter streamWriter, final Consumer<SideEffectProducer> sideEffect) {
    // initialize
    sideEffectQueue.clear();
    sideEffect.accept(sideEffectQueue);
    final var intent = (ProcessInstanceIntent) record.getIntent();
    final var recordValue = record.getValue();
    context.init(record.getKey(), recordValue, intent);
    final var bpmnElementType = recordValue.getBpmnElementType();
    final var processor = processors.getProcessor(bpmnElementType);
    final ExecutableFlowElement element = getElement(recordValue, processor);
    stateTransitionGuard.isValidStateTransition(context).ifRightOrLeft(ok -> {
        LOGGER.trace("Process process instance event [context: {}]", context);
        processEvent(intent, processor, element);
    }, violation -> rejectionWriter.appendRejection(record, RejectionType.INVALID_STATE, violation.getMessage()));
}
Also used : ExecutableFlowElement(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElement) ProcessInstanceIntent(io.camunda.zeebe.protocol.record.intent.ProcessInstanceIntent)

Aggregations

ExecutableFlowElement (io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElement)3 ProcessInstanceIntent (io.camunda.zeebe.protocol.record.intent.ProcessInstanceIntent)3