示例#1
0
        protected internal virtual IList <CorrelationHandlerResult> correlateStartMessageByEventSubscription(CommandContext commandContext, string messageName, CorrelationSet correlationSet)
        {
            IList <CorrelationHandlerResult> results = new List <CorrelationHandlerResult>();
            DeploymentCache deploymentCache          = commandContext.ProcessEngineConfiguration.DeploymentCache;

            IList <EventSubscriptionEntity> messageEventSubscriptions = findMessageStartEventSubscriptions(commandContext, messageName, correlationSet);

            foreach (EventSubscriptionEntity messageEventSubscription in messageEventSubscriptions)
            {
                if (!string.ReferenceEquals(messageEventSubscription.Configuration, null))
                {
                    string processDefinitionId = messageEventSubscription.Configuration;
                    ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
                    // only an active process definition will be returned
                    if (processDefinition != null && !processDefinition.Suspended)
                    {
                        CorrelationHandlerResult result = CorrelationHandlerResult.matchedProcessDefinition(processDefinition, messageEventSubscription.ActivityId);
                        results.Add(result);
                    }
                    else
                    {
                        LOG.couldNotFindProcessDefinitionForEventSubscription(messageEventSubscription, processDefinitionId);
                    }
                }
            }
            return(results);
        }