Exemplo n.º 1
0
 internal void CreateQueue(ActivityExecutionContext context)
 {
     if (StateMachineHelpers.IsRootExecutionContext(context))
     {
         WorkflowQueuingService   service      = context.GetService <WorkflowQueuingService>();
         MessageEventSubscription subscription = new MessageEventSubscription("SetStateQueue", this._instanceId);
         service.CreateWorkflowQueue("SetStateQueue", true);
         base.SubscriptionId = subscription.SubscriptionId;
     }
 }
 internal void CreateQueue(ActivityExecutionContext context)
 {
     if (StateMachineHelpers.IsRootExecutionContext(context))
     {
         WorkflowQueuingService service = context.GetService<WorkflowQueuingService>();
         MessageEventSubscription subscription = new MessageEventSubscription("SetStateQueue", this._instanceId);
         service.CreateWorkflowQueue("SetStateQueue", true);
         base.SubscriptionId = subscription.SubscriptionId;
     }
 }
        private void CreateSubscription(Guid instanceId, ActivityExecutionContext context, ICollection <CorrelationProperty> correlationValues)
        {
            WorkflowQueuingService queueSvcs = context.GetService <WorkflowQueuingService>();
            EventQueueName         queueId   = new EventQueueName(this.interfaceType, this.followerOperation, correlationValues);

            WorkflowQueue workflowQueue = null;

            if (!queueSvcs.Exists(queueId))
            {
                WorkflowActivityTrace.Activity.TraceEvent(TraceEventType.Information, 0, "CorrelationTokenInvalidatedHandler: creating q {0} ", queueId.GetHashCode());
                workflowQueue = queueSvcs.CreateWorkflowQueue(queueId, true);
                queueCreator  = true;
            }
            else
            {
                workflowQueue = queueSvcs.GetWorkflowQueue(queueId);
            }

            if (this.eventHandler != null)
            {
                workflowQueue.RegisterForQueueItemAvailable(this.eventHandler);
            }

            WorkflowSubscriptionService subscriptionService = (WorkflowSubscriptionService)context.GetService(typeof(WorkflowSubscriptionService));

            MessageEventSubscription subscription = new MessageEventSubscription(queueId, instanceId);

            this.queueName             = queueId;
            this.subscriptionId        = subscription.SubscriptionId;
            subscription.InterfaceType = this.interfaceType;
            subscription.MethodName    = this.followerOperation;

            this.interfaceType     = null;
            this.followerOperation = null;

            if (correlationValues != null)
            {
                foreach (CorrelationProperty property in correlationValues)
                {
                    subscription.CorrelationProperties.Add(property);
                }
            }

            if (this.eventHandler != null)
            {
                return;
            }

            if (subscriptionService == null)
            {
                return;
            }
            subscriptionService.CreateSubscription(subscription);
        }
        internal void CreateQueue(ActivityExecutionContext context)
        {
            if (!StateMachineHelpers.IsRootExecutionContext(context))
            {
                // we only subscribe to the set state event if
                // we're at the root level. If this instance is
                // being called, it is not possible to set the
                // state from the host side directly
                return;
            }

            WorkflowQueuingService workflowQueuingService = context.GetService <WorkflowQueuingService>();

            MessageEventSubscription subscription = new MessageEventSubscription(
                StateMachineWorkflowActivity.SetStateQueueName,
                this._instanceId);

            WorkflowQueue workflowQueue = workflowQueuingService.CreateWorkflowQueue(
                StateMachineWorkflowActivity.SetStateQueueName,
                true);

            this.SubscriptionId = subscription.SubscriptionId;
        }
 public abstract void CreateSubscription(MessageEventSubscription subscription);