Beispiel #1
0
        protected internal virtual void HandleStartEvent(EventSubscriptionEntity eventSubscription, object payload,
                                                         CommandContext commandContext)
        {
            var processDefinitionId = eventSubscription.Configuration;

            EnsureUtil.EnsureNotNull(
                "Configuration of signal start event subscription '" + eventSubscription.Id +
                "' contains no process definition id.", processDefinitionId);

            DeploymentCache         deploymentCache   = Context.ProcessEngineConfiguration.DeploymentCache;
            ProcessDefinitionEntity processDefinition =
                deploymentCache.FindDeployedProcessDefinitionById(processDefinitionId);

            if (processDefinition == null || processDefinition.Suspended)
            {
                // ignore event subscription
                Log.DebugIgnoringEventSubscription(eventSubscription, processDefinitionId);
            }
            else
            {
                ActivityImpl        signalStartEvent = (ActivityImpl)processDefinition.FindActivity(eventSubscription.ActivityId);
                IPvmProcessInstance processInstance  = processDefinition.CreateProcessInstanceForInitial(signalStartEvent);
                processInstance.Start();
            }
        }