if(!subscriptionsForSameMessageName.isEmpty()) {
throw new ActivitiException("Cannot deploy process definition '" + processDefinition.getResourceName()
+ "': there already is a message event subscription for the message with name '" + messageEventDefinition.getEventName() + "'.");
}
MessageEventSubscriptionEntity newSubscription = new MessageEventSubscriptionEntity();
newSubscription.setEventName(messageEventDefinition.getEventName());
newSubscription.setActivityId(messageEventDefinition.getActivityId());
newSubscription.setConfiguration(processDefinition.getId());
newSubscription.insert();
}
}
}
}