Пример #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;

            var messageEventSubscriptions = FindMessageStartEventSubscriptions(commandContext, messageName,
                                                                               correlationSet);

            foreach (var messageEventSubscription in messageEventSubscriptions)
            {
                if (messageEventSubscription.Configuration != null)
                {
                    var 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);
        }