private bool ProcessQueueItem(ActivityExecutionContext context) { WorkflowQueuingService qService = context.GetService <WorkflowQueuingService>(); if (!qService.Exists(this.QueueName)) { return(false); } WorkflowQueue queue = qService.GetWorkflowQueue(this.QueueName); // If the queue has messages, then process the first one if (queue.Count == 0) { return(false); } FileWatcherEventArgs e = (FileWatcherEventArgs)queue.Dequeue(); // Raise the FileSystemEvent base.RaiseGenericEvent <FileWatcherEventArgs>(FileSystemEvent.FileWatcherEventHandlerEvent, this, e); DoUnsubscribe(context, this); DeleteQueue(context); return(true); }
private void DeliverToWorkflow(FileWatcherSubscription subscription, FileSystemEventArgs fileSystemEventArgs) { try { // We can't just use the FileSystemEventArgs because it's not serializable FileWatcherEventArgs eventArgs = new FileWatcherEventArgs(fileSystemEventArgs); WorkflowInstance workflowInstance = this.runtime.GetWorkflow(subscription.WorkflowInstanceId); workflowInstance.EnqueueItem(subscription.QueueName, eventArgs, null, null); } catch (Exception e) { // Write the exception out to the Debug console and throw the exception System.Diagnostics.Debug.WriteLine(e); throw e; } }
private void AfterFileSystemEvent(object sender, FileWatcherEventArgs e) { FileSystemEvent activity = sender as FileSystemEvent; Console.WriteLine("FileSystemEvent '" + activity.Name + "' is handling an event..."); }