1 #region Using directives
4 using System.Diagnostics;
5 using System.Collections.Generic;
6 using System.Collections;
7 using System.Reflection;
8 using System.Runtime.Serialization;
9 using System.Workflow.ComponentModel;
10 using System.Workflow.Runtime;
11 using System.Workflow.Runtime.Hosting;
12 using System.Runtime.Remoting.Messaging;
16 namespace System.Workflow.Activities
19 internal sealed class FollowerQueueCreator : IActivityEventListener<QueueEventArgs>
21 string followerOperation;
22 object sync = new object();
24 internal FollowerQueueCreator(string operation)
26 this.followerOperation = operation;
29 public override bool Equals(object obj)
33 FollowerQueueCreator equalsObject = obj as FollowerQueueCreator;
34 if (this.followerOperation == equalsObject.followerOperation)
38 public override int GetHashCode()
40 return this.followerOperation.GetHashCode();
43 #region IActivityEventListener<QueueEventArgs> Members
45 void IActivityEventListener<QueueEventArgs>.OnEvent(object sender, QueueEventArgs args)
49 WorkflowQueue queue = (WorkflowQueue)sender;
51 // create the queue after extracting the correlation values from the message
52 EventQueueName staticId = (EventQueueName)queue.QueueName;
53 WorkflowActivityTrace.Activity.TraceEvent(TraceEventType.Information, 0, "FollowerQueueCreator: initialized on operation {0} for follower {1}", staticId.InterfaceType.Name + staticId.MethodName, this.followerOperation);
55 IMethodMessage message = queue.Peek() as IMethodMessage;
57 ICollection<CorrelationProperty> corrValues = CorrelationResolver.ResolveCorrelationValues(staticId.InterfaceType, staticId.MethodName, message.Args, false);
59 EventQueueName queueName = new EventQueueName(staticId.InterfaceType, this.followerOperation, corrValues);
60 if (!queue.QueuingService.Exists(queueName))
62 WorkflowActivityTrace.Activity.TraceEvent(TraceEventType.Information, 0, "FollowerQueueCreator::CreateQueue creating q {0}", queueName.GetHashCode());
63 queue.QueuingService.CreateWorkflowQueue(queueName, true);