Esempio n. 1
0
        public static void UpdateTask
        (
            this TaskQueueManager taskQueueManager,
            TaskProcessorJob job,
            Exception exception
        )
        {
            // Sanity.
            if (null == taskQueueManager)
            {
                throw new ArgumentNullException(nameof(taskQueueManager));
            }
            if (null == job)
            {
                throw new ArgumentNullException(nameof(job));
            }
            if (null == exception)
            {
                throw new ArgumentNullException(nameof(exception));
            }

            // Use the other overload.
            taskQueueManager.UpdateTask
            (
                job.AppTaskId,
                MFTaskState.MFTaskStateFailed,
                exception.ToString()
            );
        }
        public void MessagingWorks()
        {
            var exps = new List<Exception>();
            var bus = new InProcMessageBus((_, e) => exps.Add(e));
            var mgr = new TaskQueueManager(bus);
            string res = null;
            mgr.Subscribe<Message>(async m => { res = m.Data; });
            mgr.Enqueue(new Message() {Data = "123"});

            bus.WaitForPending().Wait();
            Assert.Empty(exps);
            Assert.Equal("123", res);
        }
Esempio n. 3
0
        public static void UpdateTask
        (
            this TaskQueueManager taskQueueManager,
            TaskProcessorJob job,
            MFTaskState state,
            string progressData = ""
        )
        {
            // Sanity.
            if (null == taskQueueManager)
            {
                throw new ArgumentNullException(nameof(taskQueueManager));
            }
            if (null == job)
            {
                throw new ArgumentNullException(nameof(job));
            }

            // Use the default UpdateTask implementation.
            taskQueueManager.UpdateTask(job.AppTaskId, state, progressData);
        }