protected override void EndProcessing()
        {
            var privateData = (Hashtable)MyInvocation.MyCommand.Module.PrivateData;
            var context     = (OrchestrationContext)privateData[SetFunctionInvocationContextCommand.ContextKey];

            var task = new ExternalEventTask(EventName);

            _durableTaskHandler.StopAndInitiateDurableTaskOrReplay(
                task, context, NoWait.IsPresent, WriteObject, failureReason => DurableActivityErrorHandler.Handle(this, failureReason));
        }
Beispiel #2
0
        protected override void EndProcessing()
        {
            var privateData = (Hashtable)MyInvocation.MyCommand.Module.PrivateData;
            var context     = (OrchestrationContext)privateData[SetFunctionInvocationContextCommand.ContextKey];

            DateTime fireAt = context.CurrentUtcDateTime.Add(Duration);
            var      task   = new DurableTimerTask(fireAt);

            _durableTaskHandler.StopAndInitiateDurableTaskOrReplay(
                task, context, NoWait.IsPresent, WriteObject, failureReason => DurableActivityErrorHandler.Handle(this, failureReason));
        }
Beispiel #3
0
        protected override void EndProcessing()
        {
            var privateData     = (Hashtable)MyInvocation.MyCommand.Module.PrivateData;
            var context         = (OrchestrationContext)privateData[SetFunctionInvocationContextCommand.ContextKey];
            var loadedFunctions = FunctionLoader.GetLoadedFunctions();

            var task = new ActivityInvocationTask(FunctionName, Input, RetryOptions);

            ActivityInvocationTask.ValidateTask(task, loadedFunctions);

            _durableTaskHandler.StopAndInitiateDurableTaskOrReplay(
                task, context, NoWait.IsPresent,
                output: WriteObject,
                onFailure: failureReason => DurableActivityErrorHandler.Handle(this, failureReason),
                retryOptions: RetryOptions);
        }
        public void WritesCorrectError()
        {
            const string ErrorMessage = "My error message";

            var errorWritten = false;

            DurableActivityErrorHandler.CreateAndWriteError(
                ErrorMessage,
                errorRecord => {
                errorWritten = true;
                Assert.Equal("Functions.Durable.ActivityFailure", errorRecord.FullyQualifiedErrorId);
                Assert.IsType <ActivityFailureException>(errorRecord.Exception);
                Assert.Equal(ErrorMessage, errorRecord.Exception.Message);
                Assert.Equal(ErrorCategory.NotSpecified, errorRecord.CategoryInfo.Category);
                Assert.Null(errorRecord.TargetObject);
            });

            Assert.True(errorWritten);
        }