private static void CreateFollowerEntry(IServiceProvider context, Type interfaceType, string followermethodName, string initializermethodName) { if (!CorrelationResolver.IsInitializingMember(interfaceType, initializermethodName, null)) { return; } WorkflowQueuingService queueSvcs = (WorkflowQueuingService)context.GetService(typeof(WorkflowQueuingService)); FollowerQueueCreator follower = new FollowerQueueCreator(followermethodName); WorkflowActivityTrace.Activity.TraceEvent(TraceEventType.Information, 0, "Creating follower {0} on initializer {1}", interfaceType.Name + followermethodName, interfaceType.Name + initializermethodName); ICollection <CorrelationProperty> corrValues = CorrelationResolver.ResolveCorrelationValues(interfaceType, initializermethodName, null, true); EventQueueName key = new EventQueueName(interfaceType, initializermethodName, corrValues); WorkflowQueue initializerQueue = null; if (queueSvcs.Exists(key)) { initializerQueue = queueSvcs.GetWorkflowQueue(key); } else { // traversed follower before initializer initializerQueue = queueSvcs.CreateWorkflowQueue(key, true); initializerQueue.Enabled = false; } initializerQueue.RegisterForQueueItemArrived(follower); }
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { if (executionContext == null) { throw new ArgumentNullException("executionContext"); } if (this.Fault == null) { throw new InvalidOperationException(SR.GetString(CultureInfo.CurrentCulture, "Error_PropertyNotSet", new object[] { FaultProperty.Name })); } WorkflowQueuingService service = executionContext.GetService <WorkflowQueuingService>(); base.RaiseEvent(SendingFaultEvent, this, EventArgs.Empty); WebServiceInputActivity activityByName = base.GetActivityByName(this.InputActivityName) as WebServiceInputActivity; IComparable queueName = new EventQueueName(activityByName.InterfaceType, activityByName.MethodName, activityByName.QualifiedName); IMethodResponseMessage message = null; WorkflowQueue workflowQueue = service.GetWorkflowQueue(queueName); if (workflowQueue.Count != 0) { message = workflowQueue.Dequeue() as IMethodResponseMessage; } message.SendException(this.Fault); return(ActivityExecutionStatus.Closed); }
public override bool Equals(object obj) { EventQueueName eventQueueName = obj as EventQueueName; if (eventQueueName == null) { return(false); } return(0 == this.CompareTo(eventQueueName)); }
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); }
public void EventHandler(object sender, ExternalDataEventArgs eventArgs) { if (eventArgs == null) { throw new ArgumentNullException("eventArgs"); } try { object workItem; IPendingWork workHandler; object[] args = this.enqueueWrapper.PrepareEventArgsArray(sender, eventArgs, out workItem, out workHandler); EventQueueName key = GetKey(args); String securityIdentifier = null; if (eventArgs.Identity == null) { IIdentity identity = System.Threading.Thread.CurrentPrincipal.Identity; WindowsIdentity windowsIdentity = identity as WindowsIdentity; if (windowsIdentity != null && windowsIdentity.User != null) { securityIdentifier = windowsIdentity.User.Translate(typeof(NTAccount)).ToString(); } else if (identity != null) { securityIdentifier = identity.Name; } eventArgs.Identity = securityIdentifier; } else { securityIdentifier = eventArgs.Identity; } MethodMessage message = new MethodMessage(this.proxiedType, this.eventName, args, securityIdentifier); WorkflowActivityTrace.Activity.TraceEvent(TraceEventType.Information, 0, "Firing event {0} for instance {1}", this.eventName, eventArgs.InstanceId); this.enqueueWrapper.DeliverMessage(eventArgs, key, message, workItem, workHandler); } catch (Exception e) { if (ExternalDataExchangeService.IsIrrecoverableException(e)) { throw; } else { throw new EventDeliveryFailedException(SR.GetString(SR.Error_EventDeliveryFailedException, this.proxiedType, this.eventName, eventArgs.InstanceId), e); } } }
public override bool Equals(object obj) { EventQueueName k = obj as EventQueueName; //Without the cast we end up in op_Equality below if ((object)k == null) { return(false); } return(0 == CompareTo(k)); }
public int CompareTo(EventQueueName eventQueueName) { if (eventQueueName == null) { return(-1); } int num = StringComparer.Ordinal.Compare(this.MethodName, eventQueueName.MethodName); if (num == 0) { num = StringComparer.Ordinal.Compare(this.AssemblyQualifiedName, eventQueueName.AssemblyQualifiedName); if ((num != 0) || (this.correlationValues == null)) { return(num); } num = (eventQueueName.correlationValues != null) ? (this.correlationValues.Length - eventQueueName.correlationValues.Length) : -1; if (num != 0) { return(num); } for (int i = 0; i < this.correlationValues.Length; i++) { if ((this.correlationValues[i] == null) || (eventQueueName.correlationValues[i] == null)) { return(-1); } object obj2 = this.correlationValues[i].Value; object obj3 = this.FindCorrelationValue(this.correlationValues[i].Name, eventQueueName.correlationValues); if ((obj2 != null) || (obj3 != null)) { if (obj2 == null) { return(-1); } IComparable comparable = obj2 as IComparable; if (comparable != null) { num = comparable.CompareTo(obj3); if (num != 0) { return(num); } } else if (!obj2.Equals(obj3)) { return(-1); } } } } return(num); }
private void ProcessParameters(ActivityExecutionContext context, IMethodMessage message, Type interfaceType, string operation) { WorkflowParameterBindingCollection parameters = ParameterBindings; if (parameters == null) { return; } //cache mInfo todo MethodInfo mInfo = interfaceType.GetMethod(operation); if (mInfo == null) { return; } int index = 0; bool responseRequired = false; foreach (ParameterInfo formalParameter in mInfo.GetParameters()) { // populate in params, checking on IsIn alone is not sufficient if (!(formalParameter.ParameterType.IsByRef || (formalParameter.IsIn && formalParameter.IsOut))) { if (parameters.Contains(formalParameter.Name)) { WorkflowParameterBinding binding = parameters[formalParameter.Name]; binding.Value = message.Args[index++]; } } else { responseRequired = true; } } if (mInfo.ReturnType != typeof(void) || responseRequired) { // create queue entry {interface, operation and receive activity Id} IComparable queueId = new EventQueueName(interfaceType, operation, QualifiedName); // enqueue the message for sendresponse reply context WorkflowQueuingService queuingService = (WorkflowQueuingService)context.GetService(typeof(WorkflowQueuingService)); if (!queuingService.Exists(queueId)) { queuingService.CreateWorkflowQueue(queueId, true); } queuingService.GetWorkflowQueue(queueId).Enqueue(message); } }
public int CompareTo(EventQueueName eventQueueName) { if (eventQueueName == null) { return -1; } int num = StringComparer.Ordinal.Compare(this.MethodName, eventQueueName.MethodName); if (num == 0) { num = StringComparer.Ordinal.Compare(this.AssemblyQualifiedName, eventQueueName.AssemblyQualifiedName); if ((num != 0) || (this.correlationValues == null)) { return num; } num = (eventQueueName.correlationValues != null) ? (this.correlationValues.Length - eventQueueName.correlationValues.Length) : -1; if (num != 0) { return num; } for (int i = 0; i < this.correlationValues.Length; i++) { if ((this.correlationValues[i] == null) || (eventQueueName.correlationValues[i] == null)) { return -1; } object obj2 = this.correlationValues[i].Value; object obj3 = this.FindCorrelationValue(this.correlationValues[i].Name, eventQueueName.correlationValues); if ((obj2 != null) || (obj3 != null)) { if (obj2 == null) { return -1; } IComparable comparable = obj2 as IComparable; if (comparable != null) { num = comparable.CompareTo(obj3); if (num != 0) { return num; } } else if (!obj2.Equals(obj3)) { return -1; } } } } return num; }
private static void SafeEnqueueItem(WorkflowInstance instance, EventQueueName key, MethodMessage message) { Label_0000: try { instance.EnqueueItem(key, message, null, null); } catch (WorkflowOwnershipException) { WorkflowActivityTrace.Activity.TraceEvent(TraceEventType.Warning, 0, string.Format(CultureInfo.InvariantCulture, "Workflow Web Host Encountered Workflow Instance Ownership conflict for instanceid {0}.", new object[] { instance.InstanceId })); Thread.Sleep(500); goto Label_0000; } }
private ActivityExecutionStatus ExecuteForActivity(ActivityExecutionContext context, Type interfaceType, string operation) { WorkflowQueuingService queueSvcs = (WorkflowQueuingService)context.GetService(typeof(WorkflowQueuingService)); IComparable queueId = new EventQueueName(interfaceType, operation); if (queueId != null) { WorkflowQueue queue; object msg = InboundActivityHelper.DequeueMessage(queueId, queueSvcs, this, out queue); if (msg != null) { this.ProcessMessage(context, msg, interfaceType, operation); return(ActivityExecutionStatus.Closed); } } return(ActivityExecutionStatus.Executing); }
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); } } }
//Back - off logic for conflicting workflow load across workflow runtime boundaries. static void SafeEnqueueItem(WorkflowInstance instance, EventQueueName key, MethodMessage message) { while (true) //When Execution times out ASP.NET going to forcefully plung this request. { try { instance.EnqueueItem(key, message, null, null); return; } catch (WorkflowOwnershipException) { WorkflowActivityTrace.Activity.TraceEvent(TraceEventType.Warning, 0, String.Format(System.Globalization.CultureInfo.InvariantCulture, "Workflow Web Host Encountered Workflow Instance Ownership conflict for instanceid {0}.", instance.InstanceId)); //Back-off for 1/2 sec. Should we make this configurable? System.Threading.Thread.Sleep(500); continue; } } }
public void EventHandler(object sender, ExternalDataEventArgs eventArgs) { if (eventArgs == null) { throw new ArgumentNullException("eventArgs"); } try { object obj2; IPendingWork work; object[] objArray = this.enqueueWrapper.PrepareEventArgsArray(sender, eventArgs, out obj2, out work); EventQueueName key = this.GetKey(objArray); string name = null; if (eventArgs.Identity == null) { IIdentity identity = Thread.CurrentPrincipal.Identity; WindowsIdentity identity2 = identity as WindowsIdentity; if ((identity2 != null) && (identity2.User != null)) { name = identity2.User.Translate(typeof(NTAccount)).ToString(); } else if (identity != null) { name = identity.Name; } eventArgs.Identity = name; } else { name = eventArgs.Identity; } MethodMessage message = new MethodMessage(this.proxiedType, this.eventName, objArray, name); WorkflowActivityTrace.Activity.TraceEvent(TraceEventType.Information, 0, "Firing event {0} for instance {1}", new object[] { this.eventName, eventArgs.InstanceId }); this.enqueueWrapper.DeliverMessage(eventArgs, key, message, obj2, work); } catch (Exception exception) { if (ExternalDataExchangeService.IsIrrecoverableException(exception)) { throw; } throw new EventDeliveryFailedException(SR.GetString("Error_EventDeliveryFailedException", new object[] { this.proxiedType, this.eventName, eventArgs.InstanceId }), exception); } }
protected sealed override void Initialize(IServiceProvider provider) { if (provider == null) { throw new ArgumentNullException("provider"); } if ((!base.IsDynamicActivity && !this.IsNestedUnderMultiInstanceContainer) || this.IsInitializingUnderMultiInstanceContainer) { Type interfaceType = this.InterfaceType; string eventName = this.EventName; IComparable comparable = null; if (CorrelationResolver.IsInitializingMember(interfaceType, eventName, null)) { comparable = new EventQueueName(interfaceType, eventName); } base.SetValue(QueueNameProperty, comparable); CorrelationService.Initialize(provider, this, interfaceType, eventName, base.WorkflowInstanceId); } }
protected sealed override void Initialize(IServiceProvider provider) { if (provider == null) { throw new ArgumentNullException("provider"); } if (base.Parent == null) { throw new InvalidOperationException(SR.GetString("Error_MustHaveParent")); } WorkflowQueuingService service = (WorkflowQueuingService)provider.GetService(typeof(WorkflowQueuingService)); EventQueueName name = new EventQueueName(this.InterfaceType, this.MethodName); base.SetValue(QueueNameProperty, name); if (!service.Exists(name)) { service.CreateWorkflowQueue(name, true); } }
private void ProcessParameters(ActivityExecutionContext context, IMethodMessage message, Type interfaceType, string operation) { WorkflowParameterBindingCollection parameterBindings = this.ParameterBindings; if (parameterBindings != null) { MethodInfo method = interfaceType.GetMethod(operation); if (method != null) { int num = 0; bool flag = false; foreach (ParameterInfo info2 in method.GetParameters()) { if (!info2.ParameterType.IsByRef && (!info2.IsIn || !info2.IsOut)) { if (parameterBindings.Contains(info2.Name)) { WorkflowParameterBinding binding = parameterBindings[info2.Name]; binding.Value = message.Args[num++]; } } else { flag = true; } } if ((method.ReturnType != typeof(void)) || flag) { IComparable queueName = new EventQueueName(interfaceType, operation, base.QualifiedName); WorkflowQueuingService service = (WorkflowQueuingService)context.GetService(typeof(WorkflowQueuingService)); if (!service.Exists(queueName)) { service.CreateWorkflowQueue(queueName, true); } service.GetWorkflowQueue(queueName).Enqueue(message); } } } }
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); } } }
private static void CreateFollowerEntry(IServiceProvider context, Type interfaceType, string followermethodName, string initializermethodName) { if (CorrelationResolver.IsInitializingMember(interfaceType, initializermethodName, null)) { WorkflowQueuingService service = (WorkflowQueuingService)context.GetService(typeof(WorkflowQueuingService)); FollowerQueueCreator eventListener = new FollowerQueueCreator(followermethodName); WorkflowActivityTrace.Activity.TraceEvent(TraceEventType.Information, 0, "Creating follower {0} on initializer {1}", new object[] { interfaceType.Name + followermethodName, interfaceType.Name + initializermethodName }); ICollection <CorrelationProperty> propertyValues = CorrelationResolver.ResolveCorrelationValues(interfaceType, initializermethodName, null, true); EventQueueName queueName = new EventQueueName(interfaceType, initializermethodName, propertyValues); WorkflowQueue workflowQueue = null; if (service.Exists(queueName)) { workflowQueue = service.GetWorkflowQueue(queueName); } else { workflowQueue = service.CreateWorkflowQueue(queueName, true); workflowQueue.Enabled = false; } workflowQueue.RegisterForQueueItemArrived(eventListener); } }
private static void CreateFollowerEntry(IServiceProvider context, Type interfaceType, string followermethodName, string initializermethodName) { if (CorrelationResolver.IsInitializingMember(interfaceType, initializermethodName, null)) { WorkflowQueuingService service = (WorkflowQueuingService) context.GetService(typeof(WorkflowQueuingService)); FollowerQueueCreator eventListener = new FollowerQueueCreator(followermethodName); WorkflowActivityTrace.Activity.TraceEvent(TraceEventType.Information, 0, "Creating follower {0} on initializer {1}", new object[] { interfaceType.Name + followermethodName, interfaceType.Name + initializermethodName }); ICollection<CorrelationProperty> propertyValues = CorrelationResolver.ResolveCorrelationValues(interfaceType, initializermethodName, null, true); EventQueueName queueName = new EventQueueName(interfaceType, initializermethodName, propertyValues); WorkflowQueue workflowQueue = null; if (service.Exists(queueName)) { workflowQueue = service.GetWorkflowQueue(queueName); } else { workflowQueue = service.CreateWorkflowQueue(queueName, true); workflowQueue.Enabled = false; } workflowQueue.RegisterForQueueItemArrived(eventListener); } }
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { if (executionContext == null) { throw new ArgumentNullException("executionContext"); } if (this.Fault == null) { throw new InvalidOperationException(SR.GetString(CultureInfo.CurrentCulture, "Error_PropertyNotSet", new object[] { FaultProperty.Name })); } WorkflowQueuingService service = executionContext.GetService<WorkflowQueuingService>(); base.RaiseEvent(SendingFaultEvent, this, EventArgs.Empty); WebServiceInputActivity activityByName = base.GetActivityByName(this.InputActivityName) as WebServiceInputActivity; IComparable queueName = new EventQueueName(activityByName.InterfaceType, activityByName.MethodName, activityByName.QualifiedName); IMethodResponseMessage message = null; WorkflowQueue workflowQueue = service.GetWorkflowQueue(queueName); if (workflowQueue.Count != 0) { message = workflowQueue.Dequeue() as IMethodResponseMessage; } message.SendException(this.Fault); return ActivityExecutionStatus.Closed; }
protected sealed override void Initialize(IServiceProvider provider) { if (provider == null) { throw new ArgumentNullException("provider"); } //When activity is dropped inside multi instance container(replicator) //We delay CorrelationService initialization to template initialization time. if ((!this.IsDynamicActivity && !IsNestedUnderMultiInstanceContainer) || IsInitializingUnderMultiInstanceContainer) { Type type = this.InterfaceType; string eventName = this.EventName; IComparable queueName = null; if (CorrelationResolver.IsInitializingMember(type, eventName, null)) { queueName = new EventQueueName(type, eventName); } this.SetValue(QueueNameProperty, queueName); CorrelationService.Initialize(provider, this, type, eventName, this.WorkflowInstanceId); } }
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { if (executionContext == null) { throw new ArgumentNullException("executionContext"); } if (this.Fault == null) { throw new InvalidOperationException(SR.GetString(CultureInfo.CurrentCulture, SR.Error_PropertyNotSet, FaultProperty.Name)); } WorkflowQueuingService queueService = executionContext.GetService <WorkflowQueuingService>(); // fire event this.RaiseEvent(WebServiceFaultActivity.SendingFaultEvent, this, EventArgs.Empty); WebServiceInputActivity webservicereceive = this.GetActivityByName(this.InputActivityName) as WebServiceInputActivity; IComparable queueId = new EventQueueName(webservicereceive.InterfaceType, webservicereceive.MethodName, webservicereceive.QualifiedName); Debug.Assert(queueService.Exists(queueId)); IMethodResponseMessage responseMessage = null; WorkflowQueue queue = queueService.GetWorkflowQueue(queueId); if (queue.Count != 0) { responseMessage = queue.Dequeue() as IMethodResponseMessage; } System.Diagnostics.Debug.Assert(responseMessage != null); // populate exception & reset the waiting thread responseMessage.SendException(this.Fault); return(ActivityExecutionStatus.Closed); }
protected sealed override void Initialize(IServiceProvider provider) { if (provider == null) { throw new ArgumentNullException("provider"); } if (this.Parent == null) { throw new InvalidOperationException(SR.GetString(SR.Error_MustHaveParent)); } WorkflowQueuingService queueService = (WorkflowQueuingService)provider.GetService(typeof(WorkflowQueuingService)); //create a static q entry EventQueueName key = new EventQueueName(this.InterfaceType, this.MethodName); this.SetValue(QueueNameProperty, key); if (!queueService.Exists(key)) { queueService.CreateWorkflowQueue(key, true); } }
protected object[] Invoke(Type interfaceType, string methodName, bool isActivation, object[] parameters) { EventHandler<WorkflowCompletedEventArgs> handler3 = null; object[] objArray; Guid workflowInstanceId = GetWorkflowInstanceId(ref isActivation); EventQueueName key = new EventQueueName(interfaceType, methodName); MethodInfo method = interfaceType.GetMethod(methodName); bool responseRequired = method.ReturnType != typeof(void); if (!responseRequired) { foreach (ParameterInfo info2 in method.GetParameters()) { if (info2.ParameterType.IsByRef || info2.IsOut) { responseRequired = true; break; } } } MethodMessage methodMessage = PrepareMessage(interfaceType, methodName, parameters, responseRequired); EventHandler<WorkflowTerminatedEventArgs> handler = null; EventHandler<WorkflowCompletedEventArgs> handler2 = null; try { WorkflowInstance workflow; if (isActivation) { workflow = this.WorkflowRuntime.CreateWorkflow(this.workflowType, null, workflowInstanceId); SafeEnqueueItem(workflow, key, methodMessage); workflow.Start(); } else { workflow = this.WorkflowRuntime.GetWorkflow(workflowInstanceId); SafeEnqueueItem(workflow, key, methodMessage); } bool workflowTerminated = false; handler = delegate (object sender, WorkflowTerminatedEventArgs e) { if (e.WorkflowInstance.InstanceId.Equals(workflowInstanceId)) { methodMessage.SendException(e.Exception); workflowTerminated = true; } }; if (handler3 == null) { handler3 = delegate (object sender, WorkflowCompletedEventArgs e) { if (e.WorkflowInstance.InstanceId.Equals(workflowInstanceId)) { methodMessage.SendException(new ApplicationException(SR.GetString(CultureInfo.CurrentCulture, "Error_WorkflowCompleted"))); } }; } handler2 = handler3; this.WorkflowRuntime.WorkflowTerminated += handler; this.WorkflowRuntime.WorkflowCompleted += handler2; ManualWorkflowSchedulerService service = this.WorkflowRuntime.GetService<ManualWorkflowSchedulerService>(); if (service != null) { service.RunWorkflow(workflow.InstanceId); } if (!responseRequired) { return new object[0]; } IMethodResponseMessage message = methodMessage.WaitForResponseMessage(); if (message.Exception != null) { if (!workflowTerminated) { throw message.Exception; } throw new ApplicationException(SR.GetString(CultureInfo.CurrentCulture, "Error_WorkflowTerminated"), message.Exception); } if (message.OutArgs != null) { return ((ArrayList) message.OutArgs).ToArray(); } objArray = new object[0]; } finally { if (handler != null) { this.WorkflowRuntime.WorkflowTerminated -= handler; } if (handler2 != null) { this.WorkflowRuntime.WorkflowCompleted -= handler2; } } return objArray; }
// IComparable implementation public int CompareTo(EventQueueName eventQueueName) { if (eventQueueName == null) { return(-1); } // compare operation int compared = StringComparer.Ordinal.Compare(this.MethodName, eventQueueName.MethodName); if (compared == 0) { // compare type names #pragma warning disable 56506 compared = StringComparer.Ordinal.Compare(AssemblyQualifiedName, eventQueueName.AssemblyQualifiedName); #pragma warning restore 56506 if (compared == 0) { if (this.correlationValues != null) { compared = (eventQueueName.correlationValues != null) ? (this.correlationValues.Length - eventQueueName.correlationValues.Length) : -1; if (compared == 0) { // compare correlation values for (int i = 0; i < this.correlationValues.Length; i++) { if (this.correlationValues[i] == null || eventQueueName.correlationValues[i] == null) { compared = -1; break; // match failed } object leftValue = this.correlationValues[i].Value; object rightValue = FindCorrelationValue(this.correlationValues[i].Name, eventQueueName.correlationValues); #pragma warning suppress 56506 if (leftValue == null && rightValue == null) { continue; } // do the explicit equals check if (leftValue != null) { IComparable comparable = leftValue as IComparable; if (comparable != null) { compared = comparable.CompareTo(rightValue); if (compared != 0) { break; // match failed } } else if ((!leftValue.Equals(rightValue))) { compared = -1; break; // match failed } } else { compared = -1; break; // match failed } } } } } } return(compared); }
protected Object[] Invoke(Type interfaceType, String methodName, bool isActivation, Object[] parameters) { Guid workflowInstanceId = GetWorkflowInstanceId(ref isActivation); WorkflowInstance wfInstance; EventQueueName key = new EventQueueName(interfaceType, methodName); MethodInfo mInfo = interfaceType.GetMethod(methodName); bool responseRequired = (mInfo.ReturnType != typeof(void)); if (!responseRequired) { foreach (ParameterInfo parameter in mInfo.GetParameters()) { if (parameter.ParameterType.IsByRef || parameter.IsOut) { responseRequired = true; break; } } } MethodMessage methodMessage = PrepareMessage(interfaceType, methodName, parameters, responseRequired); EventHandler <WorkflowTerminatedEventArgs> workflowTerminationHandler = null; EventHandler <WorkflowCompletedEventArgs> workflowCompletedHandler = null; try { if (isActivation) { wfInstance = WorkflowRuntime.CreateWorkflow(this.workflowType, null, workflowInstanceId); SafeEnqueueItem(wfInstance, key, methodMessage); wfInstance.Start(); } else { wfInstance = WorkflowRuntime.GetWorkflow(workflowInstanceId); SafeEnqueueItem(wfInstance, key, methodMessage); } bool workflowTerminated = false; //Handler for workflow termination in b/w outstanding req-response. workflowTerminationHandler = delegate(Object sender, WorkflowTerminatedEventArgs e) { if (e.WorkflowInstance.InstanceId.Equals(workflowInstanceId)) { methodMessage.SendException(e.Exception); workflowTerminated = true; } }; workflowCompletedHandler = delegate(Object sender, WorkflowCompletedEventArgs e) { if (e.WorkflowInstance.InstanceId.Equals(workflowInstanceId)) { methodMessage.SendException(new ApplicationException(SR.GetString(System.Globalization.CultureInfo.CurrentCulture, SR.Error_WorkflowCompleted))); } }; WorkflowRuntime.WorkflowTerminated += workflowTerminationHandler; WorkflowRuntime.WorkflowCompleted += workflowCompletedHandler; ManualWorkflowSchedulerService scheduler = WorkflowRuntime.GetService <ManualWorkflowSchedulerService>(); if (scheduler != null) { scheduler.RunWorkflow(wfInstance.InstanceId); } if (!responseRequired) { // no ret, out or ref return(new Object[] { }); } IMethodResponseMessage response = methodMessage.WaitForResponseMessage(); if (response.Exception != null) { if (!workflowTerminated) { throw response.Exception; } else { throw new ApplicationException(SR.GetString(System.Globalization.CultureInfo.CurrentCulture, SR.Error_WorkflowTerminated), response.Exception); } } if (response.OutArgs != null) { return(((ArrayList)response.OutArgs).ToArray()); } else { return new Object[] { } }; } finally { if (workflowTerminationHandler != null) { WorkflowRuntime.WorkflowTerminated -= workflowTerminationHandler; } if (workflowCompletedHandler != null) { WorkflowRuntime.WorkflowCompleted -= workflowCompletedHandler; } } }
protected object[] Invoke(Type interfaceType, string methodName, bool isActivation, object[] parameters) { EventHandler <WorkflowCompletedEventArgs> handler3 = null; object[] objArray; Guid workflowInstanceId = GetWorkflowInstanceId(ref isActivation); EventQueueName key = new EventQueueName(interfaceType, methodName); MethodInfo method = interfaceType.GetMethod(methodName); bool responseRequired = method.ReturnType != typeof(void); if (!responseRequired) { foreach (ParameterInfo info2 in method.GetParameters()) { if (info2.ParameterType.IsByRef || info2.IsOut) { responseRequired = true; break; } } } MethodMessage methodMessage = PrepareMessage(interfaceType, methodName, parameters, responseRequired); EventHandler <WorkflowTerminatedEventArgs> handler = null; EventHandler <WorkflowCompletedEventArgs> handler2 = null; try { WorkflowInstance workflow; if (isActivation) { workflow = this.WorkflowRuntime.CreateWorkflow(this.workflowType, null, workflowInstanceId); SafeEnqueueItem(workflow, key, methodMessage); workflow.Start(); } else { workflow = this.WorkflowRuntime.GetWorkflow(workflowInstanceId); SafeEnqueueItem(workflow, key, methodMessage); } bool workflowTerminated = false; handler = delegate(object sender, WorkflowTerminatedEventArgs e) { if (e.WorkflowInstance.InstanceId.Equals(workflowInstanceId)) { methodMessage.SendException(e.Exception); workflowTerminated = true; } }; if (handler3 == null) { handler3 = delegate(object sender, WorkflowCompletedEventArgs e) { if (e.WorkflowInstance.InstanceId.Equals(workflowInstanceId)) { methodMessage.SendException(new ApplicationException(SR.GetString(CultureInfo.CurrentCulture, "Error_WorkflowCompleted"))); } }; } handler2 = handler3; this.WorkflowRuntime.WorkflowTerminated += handler; this.WorkflowRuntime.WorkflowCompleted += handler2; ManualWorkflowSchedulerService service = this.WorkflowRuntime.GetService <ManualWorkflowSchedulerService>(); if (service != null) { service.RunWorkflow(workflow.InstanceId); } if (!responseRequired) { return(new object[0]); } IMethodResponseMessage message = methodMessage.WaitForResponseMessage(); if (message.Exception != null) { if (!workflowTerminated) { throw message.Exception; } throw new ApplicationException(SR.GetString(CultureInfo.CurrentCulture, "Error_WorkflowTerminated"), message.Exception); } if (message.OutArgs != null) { return(((ArrayList)message.OutArgs).ToArray()); } objArray = new object[0]; } finally { if (handler != null) { this.WorkflowRuntime.WorkflowTerminated -= handler; } if (handler2 != null) { this.WorkflowRuntime.WorkflowCompleted -= handler2; } } return(objArray); }
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { if (executionContext == null) throw new ArgumentNullException("executionContext"); if (this.Fault == null) { throw new InvalidOperationException(SR.GetString(CultureInfo.CurrentCulture, SR.Error_PropertyNotSet, FaultProperty.Name)); } WorkflowQueuingService queueService = executionContext.GetService<WorkflowQueuingService>(); // fire event this.RaiseEvent(WebServiceFaultActivity.SendingFaultEvent, this, EventArgs.Empty); WebServiceInputActivity webservicereceive = this.GetActivityByName(this.InputActivityName) as WebServiceInputActivity; IComparable queueId = new EventQueueName(webservicereceive.InterfaceType, webservicereceive.MethodName, webservicereceive.QualifiedName); Debug.Assert(queueService.Exists(queueId)); IMethodResponseMessage responseMessage = null; WorkflowQueue queue = queueService.GetWorkflowQueue(queueId); if (queue.Count != 0) responseMessage = queue.Dequeue() as IMethodResponseMessage; System.Diagnostics.Debug.Assert(responseMessage != null); // populate exception & reset the waiting thread responseMessage.SendException(this.Fault); return ActivityExecutionStatus.Closed; }
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { if (executionContext == null) { throw new ArgumentNullException("executionContext"); } WorkflowQueuingService queueService = executionContext.GetService <WorkflowQueuingService>(); // fire event this.RaiseEvent(WebServiceOutputActivity.SendingOutputEvent, this, EventArgs.Empty); WebServiceInputActivity webservicereceive = this.GetActivityByName(this.InputActivityName) as WebServiceInputActivity; if (webservicereceive == null) { Activity parent = this.Parent; while (parent != null) { //typically if defined inside a custom activity string qualifiedName = parent.QualifiedName + "." + this.InputActivityName; webservicereceive = this.GetActivityByName(qualifiedName) as WebServiceInputActivity; if (webservicereceive != null) { break; } parent = this.Parent; } } if (webservicereceive == null) { throw new InvalidOperationException(SR.GetString(SR.Error_CannotResolveWebServiceInput, this.QualifiedName, this.InputActivityName)); } IComparable queueId = new EventQueueName(webservicereceive.InterfaceType, webservicereceive.MethodName, webservicereceive.QualifiedName); MethodInfo mInfo = webservicereceive.InterfaceType.GetMethod(webservicereceive.MethodName); if (!queueService.Exists(queueId)) { // determine if no response is required, // compiler did not catch it, do the runtime check and return if (mInfo.ReturnType == typeof(void)) { return(ActivityExecutionStatus.Closed); } bool isresponseRequired = false; foreach (ParameterInfo formalParameter in mInfo.GetParameters()) { if (formalParameter.ParameterType.IsByRef || (formalParameter.IsIn && formalParameter.IsOut)) { isresponseRequired = true; } } if (isresponseRequired) { return(ActivityExecutionStatus.Closed); } } if (!queueService.Exists(queueId)) { throw new InvalidOperationException(SR.GetString(SR.Error_WebServiceInputNotProcessed, webservicereceive.QualifiedName)); } IMethodResponseMessage responseMessage = null; WorkflowQueue queue = queueService.GetWorkflowQueue(queueId); if (queue.Count != 0) { responseMessage = queue.Dequeue() as IMethodResponseMessage; } IMethodMessage message = responseMessage as IMethodMessage; WorkflowParameterBindingCollection parameterBindings = this.ParameterBindings; ArrayList outArgs = new ArrayList(); // populate result if (this.ParameterBindings.Contains("(ReturnValue)")) { WorkflowParameterBinding retBind = this.ParameterBindings["(ReturnValue)"]; if (retBind != null) { outArgs.Add(retBind.Value); } } foreach (ParameterInfo formalParameter in mInfo.GetParameters()) { // update out and byref values if (formalParameter.ParameterType.IsByRef || (formalParameter.IsIn && formalParameter.IsOut)) { WorkflowParameterBinding binding = parameterBindings[formalParameter.Name]; outArgs.Add(binding.Value); } } // reset the waiting thread responseMessage.SendResponse(outArgs); return(ActivityExecutionStatus.Closed); }
// IComparable implementation public int CompareTo(EventQueueName eventQueueName) { if (eventQueueName == null) return -1; // compare operation int compared = StringComparer.Ordinal.Compare(this.MethodName, eventQueueName.MethodName); if (compared == 0) { // compare type names #pragma warning disable 56506 compared = StringComparer.Ordinal.Compare(AssemblyQualifiedName, eventQueueName.AssemblyQualifiedName); #pragma warning restore 56506 if (compared == 0) { if (this.correlationValues != null) { compared = (eventQueueName.correlationValues != null) ? (this.correlationValues.Length - eventQueueName.correlationValues.Length) : -1; if (compared == 0) { // compare correlation values for (int i = 0; i < this.correlationValues.Length; i++) { if (this.correlationValues[i] == null || eventQueueName.correlationValues[i] == null) { compared = -1; break; // match failed } object leftValue = this.correlationValues[i].Value; object rightValue = FindCorrelationValue(this.correlationValues[i].Name, eventQueueName.correlationValues); #pragma warning suppress 56506 if (leftValue == null && rightValue == null) { continue; } // do the explicit equals check if (leftValue != null) { IComparable comparable = leftValue as IComparable; if (comparable != null) { compared = comparable.CompareTo(rightValue); if (compared != 0) { break; // match failed } } else if ((!leftValue.Equals(rightValue))) { compared = -1; break; // match failed } } else { compared = -1; break; // match failed } } } } } } return compared; }
private static void CreateFollowerEntry(IServiceProvider context, Type interfaceType, string followermethodName, string initializermethodName) { if (!CorrelationResolver.IsInitializingMember(interfaceType, initializermethodName, null)) return; WorkflowQueuingService queueSvcs = (WorkflowQueuingService)context.GetService(typeof(WorkflowQueuingService)); FollowerQueueCreator follower = new FollowerQueueCreator(followermethodName); WorkflowActivityTrace.Activity.TraceEvent(TraceEventType.Information, 0, "Creating follower {0} on initializer {1}", interfaceType.Name + followermethodName, interfaceType.Name + initializermethodName); ICollection<CorrelationProperty> corrValues = CorrelationResolver.ResolveCorrelationValues(interfaceType, initializermethodName, null, true); EventQueueName key = new EventQueueName(interfaceType, initializermethodName, corrValues); WorkflowQueue initializerQueue = null; if (queueSvcs.Exists(key)) { initializerQueue = queueSvcs.GetWorkflowQueue(key); } else { // traversed follower before initializer initializerQueue = queueSvcs.CreateWorkflowQueue(key, true); initializerQueue.Enabled = false; } initializerQueue.RegisterForQueueItemArrived(follower); }
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { if (executionContext == null) throw new ArgumentNullException("executionContext"); WorkflowQueuingService queueService = executionContext.GetService<WorkflowQueuingService>(); // fire event this.RaiseEvent(WebServiceOutputActivity.SendingOutputEvent, this, EventArgs.Empty); WebServiceInputActivity webservicereceive = this.GetActivityByName(this.InputActivityName) as WebServiceInputActivity; if (webservicereceive == null) { Activity parent = this.Parent; while (parent != null) { //typically if defined inside a custom activity string qualifiedName = parent.QualifiedName + "." + this.InputActivityName; webservicereceive = this.GetActivityByName(qualifiedName) as WebServiceInputActivity; if (webservicereceive != null) break; parent = this.Parent; } } if (webservicereceive == null) throw new InvalidOperationException(SR.GetString(SR.Error_CannotResolveWebServiceInput, this.QualifiedName, this.InputActivityName)); IComparable queueId = new EventQueueName(webservicereceive.InterfaceType, webservicereceive.MethodName, webservicereceive.QualifiedName); MethodInfo mInfo = webservicereceive.InterfaceType.GetMethod(webservicereceive.MethodName); if (!queueService.Exists(queueId)) { // determine if no response is required, // compiler did not catch it, do the runtime check and return if (mInfo.ReturnType == typeof(void)) { return ActivityExecutionStatus.Closed; } bool isresponseRequired = false; foreach (ParameterInfo formalParameter in mInfo.GetParameters()) { if (formalParameter.ParameterType.IsByRef || (formalParameter.IsIn && formalParameter.IsOut)) { isresponseRequired = true; } } if (isresponseRequired) { return ActivityExecutionStatus.Closed; } } if (!queueService.Exists(queueId)) throw new InvalidOperationException(SR.GetString(SR.Error_WebServiceInputNotProcessed, webservicereceive.QualifiedName)); IMethodResponseMessage responseMessage = null; WorkflowQueue queue = queueService.GetWorkflowQueue(queueId); if (queue.Count != 0) responseMessage = queue.Dequeue() as IMethodResponseMessage; IMethodMessage message = responseMessage as IMethodMessage; WorkflowParameterBindingCollection parameterBindings = this.ParameterBindings; ArrayList outArgs = new ArrayList(); // populate result if (this.ParameterBindings.Contains("(ReturnValue)")) { WorkflowParameterBinding retBind = this.ParameterBindings["(ReturnValue)"]; if (retBind != null) { outArgs.Add(retBind.Value); } } foreach (ParameterInfo formalParameter in mInfo.GetParameters()) { // update out and byref values if (formalParameter.ParameterType.IsByRef || (formalParameter.IsIn && formalParameter.IsOut)) { WorkflowParameterBinding binding = parameterBindings[formalParameter.Name]; outArgs.Add(binding.Value); } } // reset the waiting thread responseMessage.SendResponse(outArgs); return ActivityExecutionStatus.Closed; }
protected Object[] Invoke(Type interfaceType, String methodName, bool isActivation, Object[] parameters) { Guid workflowInstanceId = GetWorkflowInstanceId(ref isActivation); WorkflowInstance wfInstance; EventQueueName key = new EventQueueName(interfaceType, methodName); MethodInfo mInfo = interfaceType.GetMethod(methodName); bool responseRequired = (mInfo.ReturnType != typeof(void)); if (!responseRequired) { foreach (ParameterInfo parameter in mInfo.GetParameters()) { if (parameter.ParameterType.IsByRef || parameter.IsOut) { responseRequired = true; break; } } } MethodMessage methodMessage = PrepareMessage(interfaceType, methodName, parameters, responseRequired); EventHandler<WorkflowTerminatedEventArgs> workflowTerminationHandler = null; EventHandler<WorkflowCompletedEventArgs> workflowCompletedHandler = null; try { if (isActivation) { wfInstance = WorkflowRuntime.CreateWorkflow(this.workflowType, null, workflowInstanceId); SafeEnqueueItem(wfInstance, key, methodMessage); wfInstance.Start(); } else { wfInstance = WorkflowRuntime.GetWorkflow(workflowInstanceId); SafeEnqueueItem(wfInstance, key, methodMessage); } bool workflowTerminated = false; //Handler for workflow termination in b/w outstanding req-response. workflowTerminationHandler = delegate(Object sender, WorkflowTerminatedEventArgs e) { if (e.WorkflowInstance.InstanceId.Equals(workflowInstanceId)) { methodMessage.SendException(e.Exception); workflowTerminated = true; } }; workflowCompletedHandler = delegate(Object sender, WorkflowCompletedEventArgs e) { if (e.WorkflowInstance.InstanceId.Equals(workflowInstanceId)) { methodMessage.SendException(new ApplicationException(SR.GetString(System.Globalization.CultureInfo.CurrentCulture, SR.Error_WorkflowCompleted))); } }; WorkflowRuntime.WorkflowTerminated += workflowTerminationHandler; WorkflowRuntime.WorkflowCompleted += workflowCompletedHandler; ManualWorkflowSchedulerService scheduler = WorkflowRuntime.GetService<ManualWorkflowSchedulerService>(); if (scheduler != null) { scheduler.RunWorkflow(wfInstance.InstanceId); } if (!responseRequired) { // no ret, out or ref return new Object[] { }; } IMethodResponseMessage response = methodMessage.WaitForResponseMessage(); if (response.Exception != null) { if (!workflowTerminated) throw response.Exception; else throw new ApplicationException(SR.GetString(System.Globalization.CultureInfo.CurrentCulture, SR.Error_WorkflowTerminated), response.Exception); } if (response.OutArgs != null) return ((ArrayList)response.OutArgs).ToArray(); else return new Object[] { }; } finally { if (workflowTerminationHandler != null) WorkflowRuntime.WorkflowTerminated -= workflowTerminationHandler; if (workflowCompletedHandler != null) WorkflowRuntime.WorkflowCompleted -= workflowCompletedHandler; } }
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { if (executionContext == null) { throw new ArgumentNullException("executionContext"); } WorkflowQueuingService service = executionContext.GetService<WorkflowQueuingService>(); base.RaiseEvent(SendingOutputEvent, this, EventArgs.Empty); WebServiceInputActivity activityByName = base.GetActivityByName(this.InputActivityName) as WebServiceInputActivity; if (activityByName == null) { for (Activity activity2 = base.Parent; activity2 != null; activity2 = base.Parent) { string activityQualifiedName = activity2.QualifiedName + "." + this.InputActivityName; activityByName = base.GetActivityByName(activityQualifiedName) as WebServiceInputActivity; if (activityByName != null) { break; } } } if (activityByName == null) { throw new InvalidOperationException(SR.GetString("Error_CannotResolveWebServiceInput", new object[] { base.QualifiedName, this.InputActivityName })); } IComparable queueName = new EventQueueName(activityByName.InterfaceType, activityByName.MethodName, activityByName.QualifiedName); MethodInfo method = activityByName.InterfaceType.GetMethod(activityByName.MethodName); if (!service.Exists(queueName)) { if (method.ReturnType == typeof(void)) { return ActivityExecutionStatus.Closed; } bool flag = false; foreach (ParameterInfo info2 in method.GetParameters()) { if (info2.ParameterType.IsByRef || (info2.IsIn && info2.IsOut)) { flag = true; } } if (flag) { return ActivityExecutionStatus.Closed; } } if (!service.Exists(queueName)) { throw new InvalidOperationException(SR.GetString("Error_WebServiceInputNotProcessed", new object[] { activityByName.QualifiedName })); } IMethodResponseMessage message = null; WorkflowQueue workflowQueue = service.GetWorkflowQueue(queueName); if (workflowQueue.Count != 0) { message = workflowQueue.Dequeue() as IMethodResponseMessage; } WorkflowParameterBindingCollection parameterBindings = this.ParameterBindings; ArrayList outArgs = new ArrayList(); if (this.ParameterBindings.Contains("(ReturnValue)")) { WorkflowParameterBinding binding = this.ParameterBindings["(ReturnValue)"]; if (binding != null) { outArgs.Add(binding.Value); } } foreach (ParameterInfo info3 in method.GetParameters()) { if (info3.ParameterType.IsByRef || (info3.IsIn && info3.IsOut)) { WorkflowParameterBinding binding2 = parameterBindings[info3.Name]; outArgs.Add(binding2.Value); } } message.SendResponse(outArgs); return ActivityExecutionStatus.Closed; }
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { if (executionContext == null) { throw new ArgumentNullException("executionContext"); } WorkflowQueuingService service = executionContext.GetService <WorkflowQueuingService>(); base.RaiseEvent(SendingOutputEvent, this, EventArgs.Empty); WebServiceInputActivity activityByName = base.GetActivityByName(this.InputActivityName) as WebServiceInputActivity; if (activityByName == null) { for (Activity activity2 = base.Parent; activity2 != null; activity2 = base.Parent) { string activityQualifiedName = activity2.QualifiedName + "." + this.InputActivityName; activityByName = base.GetActivityByName(activityQualifiedName) as WebServiceInputActivity; if (activityByName != null) { break; } } } if (activityByName == null) { throw new InvalidOperationException(SR.GetString("Error_CannotResolveWebServiceInput", new object[] { base.QualifiedName, this.InputActivityName })); } IComparable queueName = new EventQueueName(activityByName.InterfaceType, activityByName.MethodName, activityByName.QualifiedName); MethodInfo method = activityByName.InterfaceType.GetMethod(activityByName.MethodName); if (!service.Exists(queueName)) { if (method.ReturnType == typeof(void)) { return(ActivityExecutionStatus.Closed); } bool flag = false; foreach (ParameterInfo info2 in method.GetParameters()) { if (info2.ParameterType.IsByRef || (info2.IsIn && info2.IsOut)) { flag = true; } } if (flag) { return(ActivityExecutionStatus.Closed); } } if (!service.Exists(queueName)) { throw new InvalidOperationException(SR.GetString("Error_WebServiceInputNotProcessed", new object[] { activityByName.QualifiedName })); } IMethodResponseMessage message = null; WorkflowQueue workflowQueue = service.GetWorkflowQueue(queueName); if (workflowQueue.Count != 0) { message = workflowQueue.Dequeue() as IMethodResponseMessage; } WorkflowParameterBindingCollection parameterBindings = this.ParameterBindings; ArrayList outArgs = new ArrayList(); if (this.ParameterBindings.Contains("(ReturnValue)")) { WorkflowParameterBinding binding = this.ParameterBindings["(ReturnValue)"]; if (binding != null) { outArgs.Add(binding.Value); } } foreach (ParameterInfo info3 in method.GetParameters()) { if (info3.ParameterType.IsByRef || (info3.IsIn && info3.IsOut)) { WorkflowParameterBinding binding2 = parameterBindings[info3.Name]; outArgs.Add(binding2.Value); } } message.SendResponse(outArgs); return(ActivityExecutionStatus.Closed); }