use of org.activiti.api.runtime.event.impl.StartMessageDeployedEvents in project Activiti by Activiti.
the class StartMessageDeployedEventProducer method doStart.
public void doStart() {
List<ProcessDefinition> processDefinitions = converter.from(repositoryService.createProcessDefinitionQuery().list());
List<StartMessageDeployedEvent> messageDeployedEvents = new ArrayList<>();
for (ProcessDefinition processDefinition : processDefinitions) {
managementService.executeCommand(new FindStartMessageEventSubscriptions(processDefinition.getId())).stream().map(subscriptionConverter::convertToStartMessageSubscription).map(messageSubscription -> StartMessageDeploymentDefinitionImpl.builder().withMessageSubscription(messageSubscription).withProcessDefinition(processDefinition).build()).map(startMessageDeploymentDefinition -> StartMessageDeployedEventImpl.builder().withEntity(startMessageDeploymentDefinition).build()).forEach(messageDeployedEvents::add);
}
managementService.executeCommand(new DispatchStartMessageDeployedEvents(messageDeployedEvents));
if (!messageDeployedEvents.isEmpty()) {
eventPublisher.publishEvent(new StartMessageDeployedEvents(messageDeployedEvents));
}
}
Aggregations