Example #1
0
        private async Task Process(object item)
        {
            TaskActivity task = (TaskActivity)item;

            try
            {
                string output = await task.RunAsync(null, null);

                //eventToRespond = new TaskCompletedEvent(-1, scheduledEvent.EventId, output);
            }

            /*catch (TaskFailureException e)
             * {
             *  TraceHelper.TraceExceptionInstance(TraceEventType.Error, taskMessage.OrchestrationInstance, e);
             *  string details = IncludeDetails ? e.Details : null;
             *  eventToRespond = new TaskFailedEvent(-1, scheduledEvent.EventId, e.Message, details);
             * }*/
            catch (Exception e)
            {
                Log.Error(e.Message);

                /*TraceHelper.TraceExceptionInstance(TraceEventType.Error, taskMessage.OrchestrationInstance, e);
                 * string details = IncludeDetails
                 *  ? string.Format("Unhandled exception while executing task: {0}\n\t{1}", e, e.StackTrace)
                 *  : null;
                 * eventToRespond = new TaskFailedEvent(-1, scheduledEvent.EventId, e.Message, details);*/
            }
        }
Example #2
0
        private async void Dispatch()
        {
            while (!queue.IsCompleted)
            {
                TaskActivity task = null;

                try
                {
                    //queue.TryTake(out task);

                    task = queue.Take(); // TODO: InvalidOp
                } catch (InvalidOperationException e) {
                    Debug.WriteLine(e.Message);
                }


                if (task != null)
                {
                    Task.Factory.StartNew <Task>(Process, task);
                }
            }
        }
Example #3
0
 public void store(TaskActivity task)
 {
 }