示例#1
0
        protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            Console.WriteLine("***ourCodeActivity.Execute thread:{0}",
                              Thread.CurrentThread.ManagedThreadId);

            ActivityExecutionStatus status;
            //ActivityExecutionContextManager manager = executionContext.ExecutionContextManager;
            //ReadOnlyCollection <ActivityExecutionContext> contexts = manager.ExecutionContexts;

            //Console.WriteLine ("***ourCodeActivity.Execute {0}", contexts.Count);
            object data = workflowQueue.Peek();

            Console.WriteLine("OnQueueItemAvailable! {0}", data);

            status = base.Execute(executionContext);
            return(status);
        }
 void IActivityEventListener <QueueEventArgs> .OnEvent(object sender, QueueEventArgs args)
 {
     lock (this.sync)
     {
         WorkflowQueue  queue     = (WorkflowQueue)sender;
         EventQueueName queueName = (EventQueueName)queue.QueueName;
         WorkflowActivityTrace.Activity.TraceEvent(TraceEventType.Information, 0, "FollowerQueueCreator: initialized on operation {0} for follower {1}", new object[] { queueName.InterfaceType.Name + queueName.MethodName, this.followerOperation });
         IMethodMessage message = queue.Peek() as IMethodMessage;
         ICollection <CorrelationProperty> propertyValues = CorrelationResolver.ResolveCorrelationValues(queueName.InterfaceType, queueName.MethodName, message.Args, false);
         EventQueueName name2 = new EventQueueName(queueName.InterfaceType, this.followerOperation, propertyValues);
         if (!queue.QueuingService.Exists(name2))
         {
             WorkflowActivityTrace.Activity.TraceEvent(TraceEventType.Information, 0, "FollowerQueueCreator::CreateQueue creating q {0}", new object[] { name2.GetHashCode() });
             queue.QueuingService.CreateWorkflowQueue(name2, true);
         }
     }
 }
示例#3
0
        void IActivityEventListener <QueueEventArgs> .OnEvent(object sender, QueueEventArgs args)
        {
            lock (sync)
            {
                WorkflowQueue queue = (WorkflowQueue)sender;

                // create the queue after extracting the correlation values from the message
                EventQueueName staticId = (EventQueueName)queue.QueueName;
                WorkflowActivityTrace.Activity.TraceEvent(TraceEventType.Information, 0, "FollowerQueueCreator: initialized on operation {0} for follower {1}", staticId.InterfaceType.Name + staticId.MethodName, this.followerOperation);

                IMethodMessage message = queue.Peek() as IMethodMessage;

                ICollection <CorrelationProperty> corrValues = CorrelationResolver.ResolveCorrelationValues(staticId.InterfaceType, staticId.MethodName, message.Args, false);

                EventQueueName queueName = new EventQueueName(staticId.InterfaceType, this.followerOperation, corrValues);
                if (!queue.QueuingService.Exists(queueName))
                {
                    WorkflowActivityTrace.Activity.TraceEvent(TraceEventType.Information, 0, "FollowerQueueCreator::CreateQueue creating q {0}", queueName.GetHashCode());
                    queue.QueuingService.CreateWorkflowQueue(queueName, true);
                }
            }
        }