if (messageDto.getMessageName() == null) {
throw new InvalidRequestException(Status.BAD_REQUEST, "No message name supplied");
}
RuntimeService runtimeService = processEngine.getRuntimeService();
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()) {