use of io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElement 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()));
}
use of io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElement in project zeebe by zeebe-io.
the class BpmnStateTransitionBehavior method invokeElementContainerIfPresent.
private Either<Failure, ?> invokeElementContainerIfPresent(final ExecutableFlowElement childElement, final BpmnElementContext childContext, final ElementContainerProcessorFunction containerFunction) {
final ExecutableFlowElement containerScope;
final BpmnElementContext containerContext;
final var flowScope = childElement.getFlowScope();
if (flowScope != null) {
containerContext = stateBehavior.getFlowScopeContext(childContext);
containerScope = flowScope;
} else if (childContext.getParentElementInstanceKey() > 0) {
// no flow scope, it is called from a parent process
containerContext = stateBehavior.getParentElementInstanceContext(childContext);
containerScope = getParentProcessScope(containerContext, childContext);
} else {
// no flow scope or no parent process
return Either.right(null);
}
final var containerProcessor = processorLookUp.apply(containerScope.getElementType());
return containerFunction.apply(containerProcessor, containerScope, containerContext);
}
use of io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElement 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()));
}
use of io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElement in project zeebe by camunda-cloud.
the class BpmnStateTransitionBehavior method invokeElementContainerIfPresent.
private Either<Failure, ?> invokeElementContainerIfPresent(final ExecutableFlowElement childElement, final BpmnElementContext childContext, final ElementContainerProcessorFunction containerFunction) {
final ExecutableFlowElement containerScope;
final BpmnElementContext containerContext;
final var flowScope = childElement.getFlowScope();
if (flowScope != null) {
containerContext = stateBehavior.getFlowScopeContext(childContext);
containerScope = flowScope;
} else if (childContext.getParentElementInstanceKey() > 0) {
// no flow scope, it is called from a parent process
containerContext = stateBehavior.getParentElementInstanceContext(childContext);
containerScope = getParentProcessScope(containerContext, childContext);
} else {
// no flow scope or no parent process
return Either.right(null);
}
final var containerProcessor = processorLookUp.apply(containerScope.getElementType());
return containerFunction.apply(containerProcessor, containerScope, containerContext);
}
use of io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElement 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()));
}
Aggregations