Package org.camunda.bpm.engine.runtime

Examples of org.camunda.bpm.engine.runtime.MessageCorrelationBuilder


    try {
      ObjectMapper objectMapper = getObjectMapper();
      Map<String, Object> correlationKeys = VariableValueDto.toMap(messageDto.getCorrelationKeys(), processEngine, objectMapper);
      Map<String, Object> processVariables = VariableValueDto.toMap(messageDto.getProcessVariables(), processEngine, objectMapper);

      MessageCorrelationBuilder correlation = runtimeService
          .createMessageCorrelation(messageDto.getMessageName())
          .setVariables(processVariables)
          .processInstanceBusinessKey(messageDto.getBusinessKey());

      if (correlationKeys != null && !correlationKeys.isEmpty()) {
        for (Entry<String, Object> correlationKey  : correlationKeys.entrySet()) {
          String name = correlationKey.getKey();
          Object value = correlationKey.getValue();
          correlation.processInstanceVariableEquals(name, value);
        }
      }

      if (!messageDto.isAll()) {
        correlation.correlate();
      } else {
        correlation.correlateAll();
      }

    } catch (RestException e) {
      String errorMessage = String.format("Cannot deliver message: %s", e.getMessage());
      throw new InvalidRequestException(e.getStatus(), e, errorMessage);
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.runtime.MessageCorrelationBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.