public void SubscribeForCorrelationTokenInitializedEvent(Activity activity, IActivityEventListener <CorrelationTokenEventArgs> dataChangeListener) { if (dataChangeListener == null) { throw new ArgumentNullException("dataChangeListener"); } if (activity == null) { throw new ArgumentNullException("activity"); } ActivityExecutorDelegateInfo <CorrelationTokenEventArgs> subscriber = new ActivityExecutorDelegateInfo <CorrelationTokenEventArgs>(dataChangeListener, ContextActivityUtils.ContextActivity(activity), true); IList <ActivityExecutorDelegateInfo <CorrelationTokenEventArgs> > subscriptions = GetValue(SubscriptionsProperty) as IList <ActivityExecutorDelegateInfo <CorrelationTokenEventArgs> >; if (subscriptions == null) { subscriptions = new List <ActivityExecutorDelegateInfo <CorrelationTokenEventArgs> >(); SetValue(SubscriptionsProperty, subscriptions); } subscriptions.Add(subscriber); }
public void UnregisterForQueueItemAvailable(IActivityEventListener <QueueEventArgs> eventListener) { if (eventListener == null) { throw new ArgumentNullException("eventListener"); } lock (this.qService.SyncRoot) { ActivityExecutorDelegateInfo <QueueEventArgs> item = new ActivityExecutorDelegateInfo <QueueEventArgs>(eventListener, this.qService.CallingActivity); if (!this.qService.GetQueueState(this.queueName).AsynchronousListeners.Remove(item)) { WorkflowTrace.Runtime.TraceEvent(TraceEventType.Information, 0, "WorkflowQueue:QueueItemAvailable unsubscribe failed for activity '{0}' with context Id {1}", new object[] { item.ActivityQualifiedName, item.ContextId }); } } }
internal void Uninitialize(Activity activity) { base.SetValue(PropertiesProperty, null); CorrelationTokenEventArgs e = new CorrelationTokenEventArgs(this, false); IList <ActivityExecutorDelegateInfo <CorrelationTokenEventArgs> > list = base.GetValue(SubscriptionsProperty) as IList <ActivityExecutorDelegateInfo <CorrelationTokenEventArgs> >; if (list != null) { ActivityExecutorDelegateInfo <CorrelationTokenEventArgs>[] array = new ActivityExecutorDelegateInfo <CorrelationTokenEventArgs> [list.Count]; list.CopyTo(array, 0); foreach (ActivityExecutorDelegateInfo <CorrelationTokenEventArgs> info in array) { info.InvokeDelegate(ContextActivityUtils.ContextActivity(activity), e, true, false); } } WorkflowTrace.Runtime.TraceEvent(TraceEventType.Information, 0, "CorrelationToken Uninitialized for {0} owner activity {1}", new object[] { this.Name, this.OwnerActivityName }); }
public void UnsubscribeFromCorrelationTokenInitializedEvent(Activity activity, IActivityEventListener <CorrelationTokenEventArgs> dataChangeListener) { if (dataChangeListener == null) { throw new ArgumentNullException("dataChangeListener"); } if (activity == null) { throw new ArgumentNullException("activity"); } ActivityExecutorDelegateInfo <CorrelationTokenEventArgs> item = new ActivityExecutorDelegateInfo <CorrelationTokenEventArgs>(dataChangeListener, ContextActivityUtils.ContextActivity(activity), true); IList <ActivityExecutorDelegateInfo <CorrelationTokenEventArgs> > list = base.GetValue(SubscriptionsProperty) as IList <ActivityExecutorDelegateInfo <CorrelationTokenEventArgs> >; if (list != null) { list.Remove(item); } }
public void SubscribeForCorrelationTokenInitializedEvent(Activity activity, IActivityEventListener<CorrelationTokenEventArgs> dataChangeListener) { if (dataChangeListener == null) { throw new ArgumentNullException("dataChangeListener"); } if (activity == null) { throw new ArgumentNullException("activity"); } ActivityExecutorDelegateInfo<CorrelationTokenEventArgs> item = new ActivityExecutorDelegateInfo<CorrelationTokenEventArgs>(dataChangeListener, ContextActivityUtils.ContextActivity(activity), true); IList<ActivityExecutorDelegateInfo<CorrelationTokenEventArgs>> list = base.GetValue(SubscriptionsProperty) as IList<ActivityExecutorDelegateInfo<CorrelationTokenEventArgs>>; if (list == null) { list = new List<ActivityExecutorDelegateInfo<CorrelationTokenEventArgs>>(); base.SetValue(SubscriptionsProperty, list); } list.Add(item); }
public void RegisterForQueueItemAvailable(IActivityEventListener<QueueEventArgs> eventListener, string subscriberQualifiedName) { if (eventListener == null) throw new ArgumentNullException("eventListener"); lock (qService.SyncRoot) { EventQueueState qState = qService.GetQueueState(this.queueName); ActivityExecutorDelegateInfo<QueueEventArgs> subscriber = new ActivityExecutorDelegateInfo<QueueEventArgs>(eventListener, qService.CallingActivity); if (subscriberQualifiedName != null) { subscriber.SubscribedActivityQualifiedName = subscriberQualifiedName; } qState.AsynchronousListeners.Add(subscriber); WorkflowTrace.Runtime.TraceEvent(TraceEventType.Information, 0, "WorkflowQueue:QueueItemAvailable subscribe for activity '{0}' with context Id {1}", subscriber.ActivityQualifiedName, subscriber.ContextId); if (qState.AsynchronousListeners.Count == 1) qService.NotifyAsynchronousSubscribers(this.queueName, qState, qState.Messages.Count); } }
internal void Uninitialize(Activity activity) { SetValue(PropertiesProperty, null); // fire correlation uninitialized events CorrelationTokenEventArgs eventArgs = new CorrelationTokenEventArgs(this, false); IList <ActivityExecutorDelegateInfo <CorrelationTokenEventArgs> > subscribers = GetValue(SubscriptionsProperty) as IList <ActivityExecutorDelegateInfo <CorrelationTokenEventArgs> >; if (subscribers != null) { ActivityExecutorDelegateInfo <CorrelationTokenEventArgs>[] clonedSubscribers = new ActivityExecutorDelegateInfo <CorrelationTokenEventArgs> [subscribers.Count]; subscribers.CopyTo(clonedSubscribers, 0); foreach (ActivityExecutorDelegateInfo <CorrelationTokenEventArgs> subscriber in clonedSubscribers) { subscriber.InvokeDelegate(ContextActivityUtils.ContextActivity(activity), eventArgs, true, false); } } //SetValue(InitializedProperty, false); WorkflowTrace.Runtime.TraceEvent(TraceEventType.Information, 0, "CorrelationToken Uninitialized for {0} owner activity {1}", this.Name, this.OwnerActivityName); }
public void RegisterForQueueItemAvailable(IActivityEventListener <QueueEventArgs> eventListener, string subscriberQualifiedName) { if (eventListener == null) { throw new ArgumentNullException("eventListener"); } lock (this.qService.SyncRoot) { EventQueueState queueState = this.qService.GetQueueState(this.queueName); ActivityExecutorDelegateInfo <QueueEventArgs> item = new ActivityExecutorDelegateInfo <QueueEventArgs>(eventListener, this.qService.CallingActivity); if (subscriberQualifiedName != null) { item.SubscribedActivityQualifiedName = subscriberQualifiedName; } queueState.AsynchronousListeners.Add(item); WorkflowTrace.Runtime.TraceEvent(TraceEventType.Information, 0, "WorkflowQueue:QueueItemAvailable subscribe for activity '{0}' with context Id {1}", new object[] { item.ActivityQualifiedName, item.ContextId }); if (queueState.AsynchronousListeners.Count == 1) { this.qService.NotifyAsynchronousSubscribers(this.queueName, queueState, queueState.Messages.Count); } } }
internal void Uninitialize(Activity activity) { base.SetValue(PropertiesProperty, null); CorrelationTokenEventArgs e = new CorrelationTokenEventArgs(this, false); IList<ActivityExecutorDelegateInfo<CorrelationTokenEventArgs>> list = base.GetValue(SubscriptionsProperty) as IList<ActivityExecutorDelegateInfo<CorrelationTokenEventArgs>>; if (list != null) { ActivityExecutorDelegateInfo<CorrelationTokenEventArgs>[] array = new ActivityExecutorDelegateInfo<CorrelationTokenEventArgs>[list.Count]; list.CopyTo(array, 0); foreach (ActivityExecutorDelegateInfo<CorrelationTokenEventArgs> info in array) { info.InvokeDelegate(ContextActivityUtils.ContextActivity(activity), e, true, false); } } WorkflowTrace.Runtime.TraceEvent(TraceEventType.Information, 0, "CorrelationToken Uninitialized for {0} owner activity {1}", new object[] { this.Name, this.OwnerActivityName }); }
public void UnregisterForQueueItemAvailable(IActivityEventListener<QueueEventArgs> eventListener) { if (eventListener == null) throw new ArgumentNullException("eventListener"); lock (qService.SyncRoot) { ActivityExecutorDelegateInfo<QueueEventArgs> subscriber = new ActivityExecutorDelegateInfo<QueueEventArgs>(eventListener, qService.CallingActivity); bool removed = qService.GetQueueState(this.queueName).AsynchronousListeners.Remove(subscriber); if (!removed) { WorkflowTrace.Runtime.TraceEvent(TraceEventType.Information, 0, "WorkflowQueue:QueueItemAvailable unsubscribe failed for activity '{0}' with context Id {1}", subscriber.ActivityQualifiedName, subscriber.ContextId); } } }