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);
}
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);
});
}
}
}
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);
}
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);
});
}
}
}
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);
}
}
Aggregations