Search in sources :

Example 1 with ExecutableMessage

use of io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableMessage in project zeebe by camunda.

the class ReceiveTaskTransformer method transform.

@Override
public void transform(final ReceiveTask element, final TransformContext context) {
    final ExecutableProcess process = context.getCurrentProcess();
    final ExecutableReceiveTask executableElement = process.getElementById(element.getId(), ExecutableReceiveTask.class);
    final Message message = element.getMessage();
    final ExecutableMessage executableMessage = context.getMessage(message.getId());
    executableElement.setMessage(executableMessage);
}
Also used : ExecutableMessage(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableMessage) ExecutableMessage(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableMessage) Message(io.camunda.zeebe.model.bpmn.instance.Message) ExecutableProcess(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableProcess) ExecutableReceiveTask(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableReceiveTask)

Example 2 with ExecutableMessage

use of io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableMessage in project zeebe by camunda.

the class MessageStartEventSubscriptionManager method openMessageStartEventSubscriptions.

private void openMessageStartEventSubscriptions(final ProcessMetadata processRecord, final StateWriter stateWriter) {
    final long processDefinitionKey = processRecord.getKey();
    final DeployedProcess processDefinition = processState.getProcessByKey(processDefinitionKey);
    final ExecutableProcess process = processDefinition.getProcess();
    final List<ExecutableStartEvent> startEvents = process.getStartEvents();
    // if startEvents contain message events
    for (final ExecutableCatchEventElement startEvent : startEvents) {
        if (startEvent.isMessage()) {
            final ExecutableMessage message = startEvent.getMessage();
            message.getMessageName().map(BufferUtil::wrapString).ifPresent(messageNameBuffer -> {
                subscriptionRecord.reset();
                subscriptionRecord.setMessageName(messageNameBuffer).setProcessDefinitionKey(processDefinitionKey).setBpmnProcessId(process.getId()).setStartEventId(startEvent.getId());
                final var subscriptionKey = keyGenerator.nextKey();
                stateWriter.appendFollowUpEvent(subscriptionKey, MessageStartEventSubscriptionIntent.CREATED, subscriptionRecord);
            });
        }
    }
}
Also used : ExecutableMessage(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableMessage) DeployedProcess(io.camunda.zeebe.engine.state.deployment.DeployedProcess) ExecutableStartEvent(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableStartEvent) ExecutableCatchEventElement(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableCatchEventElement) ExecutableProcess(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableProcess)

Example 3 with ExecutableMessage

use of io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableMessage in project zeebe by camunda.

the class CatchEventTransformer method transformMessageEventDefinition.

private void transformMessageEventDefinition(final TransformContext context, final ExecutableCatchEventElement executableElement, final MessageEventDefinition messageEventDefinition) {
    final Message message = messageEventDefinition.getMessage();
    final ExecutableMessage executableMessage = context.getMessage(message.getId());
    executableElement.setMessage(executableMessage);
}
Also used : ExecutableMessage(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableMessage) ExecutableMessage(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableMessage) Message(io.camunda.zeebe.model.bpmn.instance.Message)

Example 4 with ExecutableMessage

use of io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableMessage in project zeebe by zeebe-io.

the class MessageStartEventSubscriptionManager method openMessageStartEventSubscriptions.

private void openMessageStartEventSubscriptions(final ProcessMetadata processRecord, final StateWriter stateWriter) {
    final long processDefinitionKey = processRecord.getKey();
    final DeployedProcess processDefinition = processState.getProcessByKey(processDefinitionKey);
    final ExecutableProcess process = processDefinition.getProcess();
    final List<ExecutableStartEvent> startEvents = process.getStartEvents();
    // if startEvents contain message events
    for (final ExecutableCatchEventElement startEvent : startEvents) {
        if (startEvent.isMessage()) {
            final ExecutableMessage message = startEvent.getMessage();
            message.getMessageName().map(BufferUtil::wrapString).ifPresent(messageNameBuffer -> {
                subscriptionRecord.reset();
                subscriptionRecord.setMessageName(messageNameBuffer).setProcessDefinitionKey(processDefinitionKey).setBpmnProcessId(process.getId()).setStartEventId(startEvent.getId());
                final var subscriptionKey = keyGenerator.nextKey();
                stateWriter.appendFollowUpEvent(subscriptionKey, MessageStartEventSubscriptionIntent.CREATED, subscriptionRecord);
            });
        }
    }
}
Also used : ExecutableMessage(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableMessage) DeployedProcess(io.camunda.zeebe.engine.state.deployment.DeployedProcess) ExecutableStartEvent(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableStartEvent) ExecutableCatchEventElement(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableCatchEventElement) ExecutableProcess(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableProcess)

Example 5 with ExecutableMessage

use of io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableMessage in project zeebe by zeebe-io.

the class MessageTransformer method transform.

@Override
public void transform(final Message element, final TransformContext context) {
    final String id = element.getId();
    final ExpressionLanguage expressionLanguage = context.getExpressionLanguage();
    final ExecutableMessage executableElement = new ExecutableMessage(id);
    final ExtensionElements extensionElements = element.getExtensionElements();
    if (extensionElements != null) {
        final ZeebeSubscription subscription = extensionElements.getElementsQuery().filterByType(ZeebeSubscription.class).singleResult();
        final Expression correlationKeyExpression = expressionLanguage.parseExpression(subscription.getCorrelationKey());
        executableElement.setCorrelationKeyExpression(correlationKeyExpression);
    }
    if (element.getName() != null) {
        final Expression messageNameExpression = expressionLanguage.parseExpression(element.getName());
        executableElement.setMessageNameExpression(messageNameExpression);
        if (messageNameExpression.isStatic()) {
            final EvaluationResult messageNameResult = expressionLanguage.evaluateExpression(messageNameExpression, variable -> null);
            if (messageNameResult.getType() == ResultType.STRING) {
                final String messageName = messageNameResult.getString();
                executableElement.setMessageName(messageName);
            }
        }
        context.addMessage(executableElement);
    }
}
Also used : ExecutableMessage(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableMessage) ExtensionElements(io.camunda.zeebe.model.bpmn.instance.ExtensionElements) ZeebeSubscription(io.camunda.zeebe.model.bpmn.instance.zeebe.ZeebeSubscription) Expression(io.camunda.zeebe.el.Expression) ExpressionLanguage(io.camunda.zeebe.el.ExpressionLanguage) EvaluationResult(io.camunda.zeebe.el.EvaluationResult)

Aggregations

ExecutableMessage (io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableMessage)18 EvaluationResult (io.camunda.zeebe.el.EvaluationResult)6 Expression (io.camunda.zeebe.el.Expression)6 ExpressionLanguage (io.camunda.zeebe.el.ExpressionLanguage)6 ExecutableProcess (io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableProcess)6 Message (io.camunda.zeebe.model.bpmn.instance.Message)6 ExecutableCatchEventElement (io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableCatchEventElement)3 ExecutableReceiveTask (io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableReceiveTask)3 ExecutableStartEvent (io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableStartEvent)3 DeployedProcess (io.camunda.zeebe.engine.state.deployment.DeployedProcess)3 ExtensionElements (io.camunda.zeebe.model.bpmn.instance.ExtensionElements)3 ZeebeSubscription (io.camunda.zeebe.model.bpmn.instance.zeebe.ZeebeSubscription)3 BufferUtil (io.camunda.zeebe.util.buffer.BufferUtil)3