protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { if (executionContext == null) { throw new ArgumentNullException("executionContext"); } object[] args = null; ActivityExecutionStatus status = InboundActivityHelper.ExecuteForActivity(this, executionContext, this.InterfaceType, this.EventName, out args); if (status == ActivityExecutionStatus.Closed) { RaiseEvent(args); UnsubscribeForActivity(executionContext); executionContext.CloseActivity(); return(status); } // cannot resolve queue name or message not available // hence subscribe for message arrival if (!this.ActivitySubscribed) { this.ActivitySubscribed = CorrelationService.Subscribe(executionContext, this, this.InterfaceType, this.EventName, this, this.WorkflowInstanceId); } return(ActivityExecutionStatus.Executing); }
void IActivityEventListener <QueueEventArgs> .OnEvent(object sender, QueueEventArgs e) { ActivityExecutionContext context = (ActivityExecutionContext)sender; HandleExternalEventActivity activity = context.Activity as HandleExternalEventActivity; if (activity.ExecutionStatus == ActivityExecutionStatus.Executing) { object[] args = null; if (InboundActivityHelper.ExecuteForActivity(this, context, this.InterfaceType, this.EventName, out args) == ActivityExecutionStatus.Closed) { this.RaiseEvent(args); this.UnsubscribeForActivity(context); context.CloseActivity(); } } }
void IActivityEventListener <QueueEventArgs> .OnEvent(object sender, QueueEventArgs e) { ActivityExecutionContext context = (ActivityExecutionContext)sender; HandleExternalEventActivity activity = context.Activity as HandleExternalEventActivity; // if activity is not scheduled for execution do not dequeue the message if (activity.ExecutionStatus != ActivityExecutionStatus.Executing) { return; } object[] args = null; ActivityExecutionStatus status = InboundActivityHelper.ExecuteForActivity(this, context, this.InterfaceType, this.EventName, out args); if (status == ActivityExecutionStatus.Closed) { RaiseEvent(args); UnsubscribeForActivity(context); context.CloseActivity(); } }
protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { if (executionContext == null) { throw new ArgumentNullException("executionContext"); } object[] args = null; ActivityExecutionStatus status = InboundActivityHelper.ExecuteForActivity(this, executionContext, this.InterfaceType, this.EventName, out args); if (status == ActivityExecutionStatus.Closed) { this.RaiseEvent(args); this.UnsubscribeForActivity(executionContext); executionContext.CloseActivity(); return(status); } if (!this.ActivitySubscribed) { this.ActivitySubscribed = CorrelationService.Subscribe(executionContext, this, this.InterfaceType, this.EventName, this, base.WorkflowInstanceId); } return(ActivityExecutionStatus.Executing); }