diff --git a/Cleipnir.Tests/Flows/FlowsWithResultTests.cs b/Cleipnir.Tests/Flows/FlowsWithResultTests.cs index 6a43ec2..0b1d08d 100644 --- a/Cleipnir.Tests/Flows/FlowsWithResultTests.cs +++ b/Cleipnir.Tests/Flows/FlowsWithResultTests.cs @@ -19,8 +19,7 @@ public async Task SimpleFlowCompletesSuccessfully() var flowStore = new InMemoryFunctionStore(); var flowsContainer = new FlowsContainer( flowStore, - serviceCollection.BuildServiceProvider(), - Options.Default + serviceCollection.BuildServiceProvider() ); var flows = new SimpleFuncFlows(flowsContainer); @@ -67,7 +66,7 @@ public async Task CompletionOfScheduledFlowCanBeAwaited() var flowsContainer = new FlowsContainer( flowStore, serviceCollection.BuildServiceProvider(), - new Options(watchdogCheckFrequency: TimeSpan.FromMilliseconds(100)) + new Settings(watchdogCheckFrequency: TimeSpan.FromMilliseconds(100)) ); var flows = new SimpledDelayedFlows(flowsContainer); @@ -104,7 +103,7 @@ public async Task EventDrivenFlowCompletesSuccessfully() var flowsContainer = new FlowsContainer( flowStore, serviceCollection.BuildServiceProvider(), - new Options(watchdogCheckFrequency: TimeSpan.FromMilliseconds(100)) + new Settings(watchdogCheckFrequency: TimeSpan.FromMilliseconds(100)) ); var flows = new MessageDrivenFuncFlows(flowsContainer); @@ -151,8 +150,7 @@ public async Task FailingFlowCompletesWithError() var flowStore = new InMemoryFunctionStore(); var flowsContainer = new FlowsContainer( flowStore, - serviceCollection.BuildServiceProvider(), - new Options() + serviceCollection.BuildServiceProvider() ); var flows = new FailingFuncFlows(flowsContainer); diff --git a/Cleipnir.Tests/Flows/MultipleRegistrationTests.cs b/Cleipnir.Tests/Flows/MultipleRegistrationTests.cs index 83ee127..5239bdd 100644 --- a/Cleipnir.Tests/Flows/MultipleRegistrationTests.cs +++ b/Cleipnir.Tests/Flows/MultipleRegistrationTests.cs @@ -1,4 +1,5 @@ using Cleipnir.ResilientFunctions.Storage; +using Cleipnir.ResilientFunctions.Domain; using Microsoft.Extensions.DependencyInjection; using Shouldly; @@ -12,7 +13,7 @@ public void SameFlowTypeWithSameNameCanBeRegisteredSeveralTimes() { var serviceCollection = new ServiceCollection(); var store = new InMemoryFunctionStore(); - var flowsContainer = new FlowsContainer(store, serviceCollection.BuildServiceProvider(), new Options()); + var flowsContainer = new FlowsContainer(store, serviceCollection.BuildServiceProvider()); _ = new TestFlowType1s(flowsContainer); _ = new TestFlowType1s(flowsContainer); } @@ -22,7 +23,7 @@ public void DifferentFlowTypesWithSameNameCannotBeRegisteredSeveralTimes() { var serviceCollection = new ServiceCollection(); var store = new InMemoryFunctionStore(); - var flowsContainer = new FlowsContainer(store, serviceCollection.BuildServiceProvider(), new Options()); + var flowsContainer = new FlowsContainer(store, serviceCollection.BuildServiceProvider()); _ = new TestFlowType1s(flowsContainer); Should.Throw(() => new TestFlowType2s(flowsContainer) diff --git a/Cleipnir.Tests/Flows/OptionsTests.cs b/Cleipnir.Tests/Flows/OptionsTests.cs index 26b2a9d..94ba01f 100644 --- a/Cleipnir.Tests/Flows/OptionsTests.cs +++ b/Cleipnir.Tests/Flows/OptionsTests.cs @@ -17,7 +17,7 @@ public async Task SimpleFlowCompletesSuccessfully() serviceCollection.AddFlows(c => c .UseInMemoryStore() - .WithOptions(new Options( + .WithOptions(new Settings( messagesDefaultMaxWaitForCompletion: TimeSpan.FromDays(1), watchdogCheckFrequency: TimeSpan.FromMilliseconds(100) )) @@ -63,7 +63,7 @@ public async Task FlowNameCanBeSpecifiedFromTheOutside() serviceCollection.AddFlows(c => c .UseInMemoryStore(store) - .WithOptions(new Options( + .WithOptions(new Settings( messagesDefaultMaxWaitForCompletion: TimeSpan.FromDays(1), watchdogCheckFrequency: TimeSpan.FromMilliseconds(100) )) diff --git a/Cleipnir.Tests/Flows/ParamlessFlowsTests.cs b/Cleipnir.Tests/Flows/ParamlessFlowsTests.cs index fee11a4..d80b300 100644 --- a/Cleipnir.Tests/Flows/ParamlessFlowsTests.cs +++ b/Cleipnir.Tests/Flows/ParamlessFlowsTests.cs @@ -19,8 +19,7 @@ public async Task SimpleFlowCompletesSuccessfully() var flowStore = new InMemoryFunctionStore(); var flowsContainer = new FlowsContainer( flowStore, - serviceCollection.BuildServiceProvider(), - Options.Default + serviceCollection.BuildServiceProvider() ); var flows = new SimpleParamlessFlows(flowsContainer); @@ -60,7 +59,7 @@ public async Task EventDrivenFlowCompletesSuccessfully() var flowsContainer = new FlowsContainer( flowStore, serviceCollection.BuildServiceProvider(), - new Options(watchdogCheckFrequency: TimeSpan.FromMilliseconds(100)) + new Settings(watchdogCheckFrequency: TimeSpan.FromMilliseconds(100)) ); var flows = new EventDrivenParamlessFlows(flowsContainer); @@ -105,8 +104,7 @@ public async Task FailingFlowCompletesWithError() var flowStore = new InMemoryFunctionStore(); var flowsContainer = new FlowsContainer( flowStore, - serviceCollection.BuildServiceProvider(), - new Options() + serviceCollection.BuildServiceProvider() ); var flows = new FailingParamlessFlows(flowsContainer); diff --git a/Cleipnir.Tests/Flows/UnitFlowsTests.cs b/Cleipnir.Tests/Flows/UnitFlowsTests.cs index d38a7d8..b8144e3 100644 --- a/Cleipnir.Tests/Flows/UnitFlowsTests.cs +++ b/Cleipnir.Tests/Flows/UnitFlowsTests.cs @@ -20,8 +20,7 @@ public async Task SimpleFlowCompletesSuccessfully() var flowStore = new InMemoryFunctionStore(); var flowsContainer = new FlowsContainer( flowStore, - serviceCollection.BuildServiceProvider(), - Options.Default + serviceCollection.BuildServiceProvider() ); var flows = new SimpleUnitFlows(flowsContainer); @@ -64,7 +63,7 @@ public async Task EventDrivenFlowCompletesSuccessfully() var flowsContainer = new FlowsContainer( flowStore, serviceCollection.BuildServiceProvider(), - new Options(watchdogCheckFrequency: TimeSpan.FromMilliseconds(100)) + new Settings(watchdogCheckFrequency: TimeSpan.FromMilliseconds(100)) ); var flows = new EventDrivenUnitFlows(flowsContainer); @@ -110,8 +109,7 @@ public async Task FailingActionFlowCompletesWithError() var flowStore = new InMemoryFunctionStore(); var flowsContainer = new FlowsContainer( flowStore, - serviceCollection.BuildServiceProvider(), - new Options() + serviceCollection.BuildServiceProvider() ); var flows = new FallingUnitActionFlows(flowsContainer); @@ -160,8 +158,7 @@ public async Task FailingFuncFlowCompletesWithError() var flowStore = new InMemoryFunctionStore(); var flowsContainer = new FlowsContainer( flowStore, - serviceCollection.BuildServiceProvider(), - new Options() + serviceCollection.BuildServiceProvider() ); var flows = new FallingUnitFuncFlows(flowsContainer); @@ -210,8 +207,7 @@ public async Task FailingParamlessFlowCompletesWithError() var flowStore = new InMemoryFunctionStore(); var flowsContainer = new FlowsContainer( flowStore, - serviceCollection.BuildServiceProvider(), - new Options() + serviceCollection.BuildServiceProvider() ); var flows = new FailingUnitParamlessFlows(flowsContainer); diff --git a/Cleipnir.Tests/Flows/UtcNowTests.cs b/Cleipnir.Tests/Flows/UtcNowTests.cs index 4c9356e..b7c5f87 100644 --- a/Cleipnir.Tests/Flows/UtcNowTests.cs +++ b/Cleipnir.Tests/Flows/UtcNowTests.cs @@ -18,7 +18,7 @@ public async Task ProvidedUtcNowDelegateIsUsed() var flowsContainer = new FlowsContainer( new InMemoryFunctionStore(), serviceCollection.BuildServiceProvider(), - new Options(utcNow: () => now, watchdogCheckFrequency: TimeSpan.FromMilliseconds(100)) + new Settings(utcNow: () => now, watchdogCheckFrequency: TimeSpan.FromMilliseconds(100)) ); var flows = new Flows(nameof(UtcNowTestFlow), flowsContainer); diff --git a/Cleipnir/AspNet/FlowsModule.cs b/Cleipnir/AspNet/FlowsModule.cs index eebf1fa..d5b6fe0 100644 --- a/Cleipnir/AspNet/FlowsModule.cs +++ b/Cleipnir/AspNet/FlowsModule.cs @@ -17,7 +17,7 @@ public static IServiceCollection AddFlows(this IServiceCollection services, Func configure(configurator); if (configurator.OptionsFunc is null) - services.AddSingleton(new Options()); + services.AddSingleton(new Settings()); else services.AddSingleton(configurator.OptionsFunc); @@ -37,7 +37,7 @@ public class FlowsConfigurator(IServiceCollection services) internal bool EnableGracefulShutdown = false; internal readonly HashSet FlowsTypes = new(); - internal Func? OptionsFunc; + internal Func? OptionsFunc; public IServiceCollection Services { get; } = services; public FlowsConfigurator UseInMemoryStore(InMemoryFunctionStore? store = null) @@ -52,10 +52,10 @@ public FlowsConfigurator UseStore(IFunctionStore store) return this; } - public FlowsConfigurator WithOptions(Options options) - => WithOptions(_ => options); - - public FlowsConfigurator WithOptions(Func optionsFunc) + public FlowsConfigurator WithOptions(Settings settings) + => WithOptions(_ => settings); + + public FlowsConfigurator WithOptions(Func optionsFunc) { OptionsFunc = optionsFunc; return this; diff --git a/Cleipnir/FlowOptions.cs b/Cleipnir/FlowOptions.cs index 3dc2794..50f05cb 100644 --- a/Cleipnir/FlowOptions.cs +++ b/Cleipnir/FlowOptions.cs @@ -25,13 +25,13 @@ public FlowOptions( MaxParallelRetryInvocations = maxParallelRetryInvocations; } - public FlowOptions Merge(Options options) + public FlowOptions Merge(Settings settings) { return new FlowOptions( - RetentionPeriod ?? options.RetentionPeriod, - EnableWatchdogs ?? options.EnableWatchdogs, - MessagesDefaultMaxWaitForCompletion ?? options.MessagesDefaultMaxWaitForCompletion, - MaxParallelRetryInvocations ?? options.MaxParallelRetryInvocations + RetentionPeriod ?? settings.RetentionPeriod, + EnableWatchdogs ?? settings.EnableWatchdogs, + MessagesDefaultMaxWaitForCompletion ?? settings.MessagesDefaultMaxWaitForCompletion, + MaxParallelRetryInvocations ?? settings.MaxParallelRetryInvocations ); } diff --git a/Cleipnir/FlowsContainer.cs b/Cleipnir/FlowsContainer.cs index 6c6b41e..b3dabb6 100644 --- a/Cleipnir/FlowsContainer.cs +++ b/Cleipnir/FlowsContainer.cs @@ -3,6 +3,7 @@ using System.Threading; using System.Threading.Tasks; using Cleipnir.ResilientFunctions; +using Cleipnir.ResilientFunctions.Domain; using Cleipnir.ResilientFunctions.Storage; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -18,30 +19,31 @@ public class FlowsContainer : IDisposable public FunctionsRegistry Functions => FunctionRegistry; - public FlowsContainer(IFunctionStore flowStore, IServiceProvider serviceProvider, Options options) + public FlowsContainer(IFunctionStore flowStore, IServiceProvider serviceProvider, Settings? settings = null) { ServiceProvider = serviceProvider; + settings ??= new Settings(); - if (options.UnhandledExceptionHandler == null && serviceProvider.GetService() != null) + if (settings.UnhandledExceptionHandler == null && serviceProvider.GetService() != null) { var logger = serviceProvider.GetRequiredService(); - options = new Options( + settings = new Settings( unhandledExceptionHandler: ex => logger.LogError(ex, "Unhandled exception in Cleipnir"), - retentionPeriod: options.RetentionPeriod, - retentionCleanUpFrequency: options.RetentionCleanUpFrequency, - enableWatchdogs: options.EnableWatchdogs, - watchdogCheckFrequency: options.WatchdogCheckFrequency, - messagesPullFrequency: options.MessagesPullFrequency, - messagesDefaultMaxWaitForCompletion: options.MessagesDefaultMaxWaitForCompletion, - delayStartup: options.DelayStartup, - maxParallelRetryInvocations: options.MaxParallelRetryInvocations, - serializer: options.Serializer, - utcNow: options.UtcNow, - replicaHeartbeatFrequency: options.ReplicaHeartbeatFrequency + retentionPeriod: settings.RetentionPeriod, + retentionCleanUpFrequency: settings.RetentionCleanUpFrequency, + enableWatchdogs: settings.EnableWatchdogs, + watchdogCheckFrequency: settings.WatchdogCheckFrequency, + messagesPullFrequency: settings.MessagesPullFrequency, + messagesDefaultMaxWaitForCompletion: settings.MessagesDefaultMaxWaitForCompletion, + delayStartup: settings.DelayStartup, + maxParallelRetryInvocations: settings.MaxParallelRetryInvocations, + serializer: settings.Serializer, + utcNow: settings.UtcNow, + replicaHeartbeatFrequency: settings.ReplicaHeartbeatFrequency ); } - FunctionRegistry = new FunctionsRegistry(flowStore, options.MapToSettings()); + FunctionRegistry = new FunctionsRegistry(flowStore, settings); } internal void EnsureNoExistingRegistration(string flowName, Type flowType) @@ -77,10 +79,10 @@ public Flows RegisterAnonymousFlow new( functionStore ?? new InMemoryFunctionStore(), serviceProvider ?? new ServiceCollection().BuildServiceProvider(), - options ?? Options.Default + settings ?? new Settings() ); } diff --git a/Cleipnir/Options.cs b/Cleipnir/Options.cs deleted file mode 100644 index 2d3807f..0000000 --- a/Cleipnir/Options.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using Cleipnir.ResilientFunctions.CoreRuntime; -using Cleipnir.ResilientFunctions.CoreRuntime.Serialization; -using Cleipnir.ResilientFunctions.Domain; -using Cleipnir.ResilientFunctions.Domain.Exceptions; - -namespace Cleipnir.Flows; - -public class Options -{ - public static Options Default { get; } = new(); - - internal Action? UnhandledExceptionHandler { get; } - internal TimeSpan? RetentionPeriod { get; } - internal TimeSpan? RetentionCleanUpFrequency { get; } - internal bool? EnableWatchdogs { get; } - internal TimeSpan? WatchdogCheckFrequency { get; } - internal TimeSpan? DelayStartup { get; } - internal int? MaxParallelRetryInvocations { get; } - internal TimeSpan? MessagesPullFrequency { get; } - internal TimeSpan? MessagesDefaultMaxWaitForCompletion { get; } - internal ISerializer? Serializer { get; } - internal UtcNow? UtcNow { get; } - internal TimeSpan? ReplicaHeartbeatFrequency { get; } - - /// - /// Configuration options for Cleipnir - /// - /// Callback handler for unhandled flow exceptions - /// Period to keep completed flows before deletion. Default infinite. - /// Retention clean-up check frequency. Default 1 hour when retention period is not infinite. - /// Enable background crashed, interrupted and postponed flow scheduling. Default true. - /// Check frequency for eligible crashed, interrupted and postponed flows. Default 1 second. - /// Pull frequency for active/max-waiting messages. Default: 250ms - /// Default wait duration before suspension for messages. Defaults to none. - /// Delay watchdog start-up. Defaults to none. - /// Limit the number of watchdog started invocations. Default: 100. - /// Specify custom serializer. Default built-in json-serializer. - /// Provide custom delegate for providing current utc datetime. Default: () => DateTime.UtcNow - /// Heartbeat frequency for replica liveness detection. Default 1 second. - public Options( - Action? unhandledExceptionHandler = null, - TimeSpan? retentionPeriod = null, - TimeSpan? retentionCleanUpFrequency = null, - bool? enableWatchdogs = null, - TimeSpan? watchdogCheckFrequency = null, - TimeSpan? messagesPullFrequency = null, - TimeSpan? messagesDefaultMaxWaitForCompletion = null, - TimeSpan? delayStartup = null, - int? maxParallelRetryInvocations = null, - ISerializer? serializer = null, - UtcNow? utcNow = null, - TimeSpan? replicaHeartbeatFrequency = null - ) - { - UnhandledExceptionHandler = unhandledExceptionHandler; - WatchdogCheckFrequency = watchdogCheckFrequency; - RetentionPeriod = retentionPeriod; - RetentionCleanUpFrequency = retentionCleanUpFrequency; - EnableWatchdogs = enableWatchdogs; - MessagesPullFrequency = messagesPullFrequency; - MessagesDefaultMaxWaitForCompletion = messagesDefaultMaxWaitForCompletion; - DelayStartup = delayStartup; - MaxParallelRetryInvocations = maxParallelRetryInvocations; - Serializer = serializer; - UtcNow = utcNow; - ReplicaHeartbeatFrequency = replicaHeartbeatFrequency; - } - - public Options Merge(Options options) - { - return new Options( - UnhandledExceptionHandler ?? options.UnhandledExceptionHandler, - RetentionPeriod ?? options.RetentionPeriod, - RetentionCleanUpFrequency ?? options.RetentionCleanUpFrequency, - EnableWatchdogs ?? options.EnableWatchdogs, - WatchdogCheckFrequency ?? options.WatchdogCheckFrequency, - MessagesPullFrequency ?? options.MessagesPullFrequency, - MessagesDefaultMaxWaitForCompletion ?? options.MessagesDefaultMaxWaitForCompletion, - DelayStartup ?? options.DelayStartup, - MaxParallelRetryInvocations ?? options.MaxParallelRetryInvocations, - Serializer ?? options.Serializer, - UtcNow ?? options.UtcNow, - ReplicaHeartbeatFrequency ?? options.ReplicaHeartbeatFrequency - ); - } - - internal Settings MapToSettings() - => new( - unhandledExceptionHandler: UnhandledExceptionHandler, - retentionPeriod: RetentionPeriod, - retentionCleanUpFrequency: RetentionCleanUpFrequency, - enableWatchdogs: EnableWatchdogs, - watchdogCheckFrequency: WatchdogCheckFrequency, - messagesPullFrequency: MessagesPullFrequency, - messagesDefaultMaxWaitForCompletion: MessagesDefaultMaxWaitForCompletion, - delayStartup: DelayStartup, - maxParallelRetryInvocations: MaxParallelRetryInvocations, - serializer: Serializer, - utcNow: UtcNow, - replicaHeartbeatFrequency: ReplicaHeartbeatFrequency - ); -} diff --git a/README.md b/README.md index 3df8de1..7f54470 100644 --- a/README.md +++ b/README.md @@ -308,7 +308,7 @@ var testOrder = new Order("MK-54321", CustomerId: Guid.NewGuid(), ProductIds: [G await flows.Run( instanceId: testOrder.OrderId, testOrder, - new InitialState(Messages: [], Effects: [new InitialEffect(Id: 0, Value: transactionId, Alias: "TransactionId")]) + new InitialState(Messages: [], Effects: [new InitialEffect(Id: 0.ToEffectId(), Value: transactionId, Alias: "TransactionId")]) ); Assert.AreEqual(transactionId, usedTransactionId); diff --git a/Samples/Cleipnir.Sample.AspNet/Program.cs b/Samples/Cleipnir.Sample.AspNet/Program.cs index 63cdee5..342c4fe 100644 --- a/Samples/Cleipnir.Sample.AspNet/Program.cs +++ b/Samples/Cleipnir.Sample.AspNet/Program.cs @@ -1,4 +1,5 @@ using Cleipnir.Flows.AspNet; +using Cleipnir.ResilientFunctions.Domain; using Cleipnir.Flows.PostgresSql; using Cleipnir.Flows.Sample.Clients; using Cleipnir.Flows.Sample.Flows; @@ -27,7 +28,7 @@ private static async Task Main(string[] args) await DatabaseHelper.CreateDatabaseIfNotExists(connectionString); //use to create db initially or clean existing state in database builder.Services.AddFlows(c => c .UsePostgresStore(connectionString) - .WithOptions(new Options(replicaHeartbeatFrequency: TimeSpan.FromSeconds(5))) + .WithOptions(new Settings(replicaHeartbeatFrequency: TimeSpan.FromSeconds(5))) .RegisterFlow() ); diff --git a/Samples/Cleipnir.Sample.Presentation.AspNet/Program.cs b/Samples/Cleipnir.Sample.Presentation.AspNet/Program.cs index b0339cf..d020f7d 100644 --- a/Samples/Cleipnir.Sample.Presentation.AspNet/Program.cs +++ b/Samples/Cleipnir.Sample.Presentation.AspNet/Program.cs @@ -1,4 +1,5 @@ using Cleipnir.Flows.AspNet; +using Cleipnir.ResilientFunctions.Domain; using Cleipnir.Flows.PostgresSql; using Cleipnir.Flows.Sample.MicrosoftOpen.Clients; using Cleipnir.Flows.Sample.MicrosoftOpen.Flows; @@ -32,7 +33,7 @@ private static async Task Main(string[] args) //await DatabaseHelper.RecreateDatabase(connectionString); builder.Services.AddFlows(c => c .UsePostgresStore(connectionString) - .WithOptions(new Options(replicaHeartbeatFrequency: TimeSpan.FromSeconds(5), messagesDefaultMaxWaitForCompletion: TimeSpan.MaxValue)) + .WithOptions(new Settings(replicaHeartbeatFrequency: TimeSpan.FromSeconds(5), messagesDefaultMaxWaitForCompletion: TimeSpan.MaxValue)) .RegisterFlow() .RegisterFlow>() .RegisterFlow() diff --git a/Samples/Cleipnir.Sample.Presentation/A_OrderFlowRpc/Example.cs b/Samples/Cleipnir.Sample.Presentation/A_OrderFlowRpc/Example.cs index 43a61ba..9032235 100644 --- a/Samples/Cleipnir.Sample.Presentation/A_OrderFlowRpc/Example.cs +++ b/Samples/Cleipnir.Sample.Presentation/A_OrderFlowRpc/Example.cs @@ -1,4 +1,5 @@ using Cleipnir.ResilientFunctions.Storage; +using Cleipnir.ResilientFunctions.Domain; namespace Cleipnir.Flows.Sample.Presentation.A_OrderFlowRpc; @@ -14,8 +15,7 @@ public static async Task Do() var flowsContainer = new FlowsContainer( new InMemoryFunctionStore(), - serviceCollection.BuildServiceProvider(), - Options.Default + serviceCollection.BuildServiceProvider() ); var orderFlows = new Flows(nameof(OrderFlow), flowsContainer); diff --git a/Samples/Cleipnir.Sample.Presentation/A_OrderFlowRpc/Solution/Example.cs b/Samples/Cleipnir.Sample.Presentation/A_OrderFlowRpc/Solution/Example.cs index 842a7ed..e43bb0a 100644 --- a/Samples/Cleipnir.Sample.Presentation/A_OrderFlowRpc/Solution/Example.cs +++ b/Samples/Cleipnir.Sample.Presentation/A_OrderFlowRpc/Solution/Example.cs @@ -1,4 +1,5 @@ using Cleipnir.ResilientFunctions.Storage; +using Cleipnir.ResilientFunctions.Domain; namespace Cleipnir.Flows.Sample.Presentation.A_OrderFlowRpc.Solution; @@ -14,8 +15,7 @@ public static async Task Do() var flowsContainer = new FlowsContainer( new InMemoryFunctionStore(), - serviceCollection.BuildServiceProvider(), - Options.Default + serviceCollection.BuildServiceProvider() ); var orderFlows = new Flows(nameof(OrderFlow), flowsContainer); diff --git a/Samples/Cleipnir.Sample.Presentation/B_OrderFlow_Messaging/Example.cs b/Samples/Cleipnir.Sample.Presentation/B_OrderFlow_Messaging/Example.cs index ee77873..3f00bf9 100644 --- a/Samples/Cleipnir.Sample.Presentation/B_OrderFlow_Messaging/Example.cs +++ b/Samples/Cleipnir.Sample.Presentation/B_OrderFlow_Messaging/Example.cs @@ -1,4 +1,5 @@ using Cleipnir.ResilientFunctions.Storage; +using Cleipnir.ResilientFunctions.Domain; namespace Cleipnir.Flows.Sample.Presentation.B_OrderFlow_Messaging; @@ -17,8 +18,7 @@ public static async Task Execute() var flowsContainer = new FlowsContainer( new InMemoryFunctionStore(), - serviceCollection.BuildServiceProvider(), - Options.Default + serviceCollection.BuildServiceProvider() ); var orderFlows = new Flows(nameof(OrderFlow), flowsContainer); diff --git a/Samples/Cleipnir.Sample.Presentation/B_OrderFlow_Messaging/Solution/Example.cs b/Samples/Cleipnir.Sample.Presentation/B_OrderFlow_Messaging/Solution/Example.cs index 0867673..644ad70 100644 --- a/Samples/Cleipnir.Sample.Presentation/B_OrderFlow_Messaging/Solution/Example.cs +++ b/Samples/Cleipnir.Sample.Presentation/B_OrderFlow_Messaging/Solution/Example.cs @@ -1,4 +1,5 @@ using Cleipnir.ResilientFunctions.Storage; +using Cleipnir.ResilientFunctions.Domain; namespace Cleipnir.Flows.Sample.Presentation.B_OrderFlow_Messaging.Solution; @@ -17,8 +18,7 @@ public static async Task Execute() var flowsContainer = new FlowsContainer( new InMemoryFunctionStore(), - serviceCollection.BuildServiceProvider(), - Options.Default + serviceCollection.BuildServiceProvider() ); var orderFlows = new Flows(nameof(OrderFlow), flowsContainer); diff --git a/Samples/Cleipnir.Sample.Presentation/C_NewsletterSender/Distributed/Example.cs b/Samples/Cleipnir.Sample.Presentation/C_NewsletterSender/Distributed/Example.cs index 73a3d6f..e582ee8 100644 --- a/Samples/Cleipnir.Sample.Presentation/C_NewsletterSender/Distributed/Example.cs +++ b/Samples/Cleipnir.Sample.Presentation/C_NewsletterSender/Distributed/Example.cs @@ -1,5 +1,6 @@ using Cleipnir.Flows.AspNet; using Cleipnir.ResilientFunctions.PostgreSQL; +using Cleipnir.ResilientFunctions.Domain; namespace Cleipnir.Flows.Sample.Presentation.C_NewsletterSender.Distributed; @@ -21,7 +22,7 @@ public static async Task Perform() serviceCollection.AddFlows( c => c .UseStore(store) - .WithOptions(new Options(unhandledExceptionHandler: Console.WriteLine)) + .WithOptions(new Settings(unhandledExceptionHandler: Console.WriteLine)) .RegisterFlow() ); serviceCollection.AddScoped(sp => new NewsletterChildFlow(sp.GetRequiredService>(), child)); diff --git a/Samples/Cleipnir.Sample.Presentation/C_NewsletterSender/Example.cs b/Samples/Cleipnir.Sample.Presentation/C_NewsletterSender/Example.cs index 4627be2..2a47b34 100644 --- a/Samples/Cleipnir.Sample.Presentation/C_NewsletterSender/Example.cs +++ b/Samples/Cleipnir.Sample.Presentation/C_NewsletterSender/Example.cs @@ -1,5 +1,6 @@ using Cleipnir.Flows.AspNet; using Cleipnir.ResilientFunctions.PostgreSQL; +using Cleipnir.ResilientFunctions.Domain; namespace Cleipnir.Flows.Sample.Presentation.C_NewsletterSender; @@ -19,7 +20,7 @@ public static async Task Perform() serviceCollection.AddFlows( c => c .UseStore(store) - .WithOptions(new Options(unhandledExceptionHandler: Console.WriteLine)) + .WithOptions(new Settings(unhandledExceptionHandler: Console.WriteLine)) .RegisterFlow() ); diff --git a/Samples/Cleipnir.Sample.Presentation/C_NewsletterSender/Solution/Example.cs b/Samples/Cleipnir.Sample.Presentation/C_NewsletterSender/Solution/Example.cs index 0b9d4e5..f0dae5a 100644 --- a/Samples/Cleipnir.Sample.Presentation/C_NewsletterSender/Solution/Example.cs +++ b/Samples/Cleipnir.Sample.Presentation/C_NewsletterSender/Solution/Example.cs @@ -1,4 +1,5 @@ using Cleipnir.ResilientFunctions.PostgreSQL; +using Cleipnir.ResilientFunctions.Domain; namespace Cleipnir.Flows.Sample.Presentation.C_NewsletterSender.Solution; @@ -16,7 +17,7 @@ public static async Task Perform() var flowsContainer = new FlowsContainer( flowStore, serviceCollection.BuildServiceProvider(), - new Options(unhandledExceptionHandler: Console.WriteLine) + new Settings(unhandledExceptionHandler: Console.WriteLine) ); var flows = new Flows(nameof(NewsletterFlow), flowsContainer); diff --git a/Samples/Cleipnir.Samples.Console/AtLeastOnce/Example.cs b/Samples/Cleipnir.Samples.Console/AtLeastOnce/Example.cs index 71c8e10..031f03a 100644 --- a/Samples/Cleipnir.Samples.Console/AtLeastOnce/Example.cs +++ b/Samples/Cleipnir.Samples.Console/AtLeastOnce/Example.cs @@ -1,5 +1,6 @@ using Cleipnir.ResilientFunctions.Storage; using Microsoft.Extensions.DependencyInjection; +using Cleipnir.ResilientFunctions.Domain; namespace Cleipnir.Flows.Sample.ConsoleApp.AtLeastOnce; @@ -12,8 +13,7 @@ public static async Task Do() var flowsContainer = new FlowsContainer( new InMemoryFunctionStore(), - serviceCollection.BuildServiceProvider(), - Options.Default + serviceCollection.BuildServiceProvider() ); var flows = new Flows(nameof(AtLeastOnceFlow), flowsContainer); diff --git a/Samples/Cleipnir.Samples.Console/AtMostOnce/Example.cs b/Samples/Cleipnir.Samples.Console/AtMostOnce/Example.cs index 77efe49..0541b4a 100644 --- a/Samples/Cleipnir.Samples.Console/AtMostOnce/Example.cs +++ b/Samples/Cleipnir.Samples.Console/AtMostOnce/Example.cs @@ -1,5 +1,6 @@ using Cleipnir.ResilientFunctions.Storage; using Microsoft.Extensions.DependencyInjection; +using Cleipnir.ResilientFunctions.Domain; namespace Cleipnir.Flows.Sample.ConsoleApp.AtMostOnce; @@ -12,8 +13,7 @@ public static async Task Do() var flowsContainer = new FlowsContainer( new InMemoryFunctionStore(), - serviceCollection.BuildServiceProvider(), - Options.Default + serviceCollection.BuildServiceProvider() ); var flows = new Flows(nameof(AtMostOnceFlow), flowsContainer); diff --git a/Samples/Cleipnir.Samples.Console/Postpone/Example.cs b/Samples/Cleipnir.Samples.Console/Postpone/Example.cs index fa91500..d3a6786 100644 --- a/Samples/Cleipnir.Samples.Console/Postpone/Example.cs +++ b/Samples/Cleipnir.Samples.Console/Postpone/Example.cs @@ -13,8 +13,7 @@ public static async Task Do() var flowsContainer = new FlowsContainer( new InMemoryFunctionStore(), - serviceCollection.BuildServiceProvider(), - Options.Default + serviceCollection.BuildServiceProvider() ); var flows = new Flows(nameof(PostponeFlow), flowsContainer); diff --git a/Samples/Cleipnir.Samples.Console/RestartFlow/Example.cs b/Samples/Cleipnir.Samples.Console/RestartFlow/Example.cs index 71236a3..afad67c 100644 --- a/Samples/Cleipnir.Samples.Console/RestartFlow/Example.cs +++ b/Samples/Cleipnir.Samples.Console/RestartFlow/Example.cs @@ -1,5 +1,6 @@ using Cleipnir.ResilientFunctions; using Cleipnir.ResilientFunctions.Storage; +using Cleipnir.ResilientFunctions.Domain; using Microsoft.Extensions.DependencyInjection; namespace Cleipnir.Flows.Sample.ConsoleApp.RestartFlow; @@ -13,8 +14,7 @@ public static async Task Do() var flowsContainer = new FlowsContainer( new InMemoryFunctionStore(), - serviceCollection.BuildServiceProvider(), - Options.Default + serviceCollection.BuildServiceProvider() ); var flows = new Flows(nameof(RestartFailedFlow), flowsContainer); diff --git a/Samples/Cleipnir.Samples.Console/Retry/Example.cs b/Samples/Cleipnir.Samples.Console/Retry/Example.cs index b9ec7fa..a48842f 100644 --- a/Samples/Cleipnir.Samples.Console/Retry/Example.cs +++ b/Samples/Cleipnir.Samples.Console/Retry/Example.cs @@ -1,5 +1,6 @@ using Cleipnir.ResilientFunctions.PostgreSQL; using Microsoft.Extensions.DependencyInjection; +using Cleipnir.ResilientFunctions.Domain; namespace Cleipnir.Flows.Sample.ConsoleApp.Retry; @@ -18,7 +19,7 @@ public static async Task Do() var flowsContainer = new FlowsContainer( store, serviceCollection.BuildServiceProvider(), - new Options(unhandledExceptionHandler: Console.WriteLine) + new Settings(unhandledExceptionHandler: Console.WriteLine) ); var flows = new Flows(nameof(RetryFlow), flowsContainer); diff --git a/Samples/Cleipnir.Samples.Console/WaitForMessages/Example.cs b/Samples/Cleipnir.Samples.Console/WaitForMessages/Example.cs index f5c63b7..a6d98e6 100644 --- a/Samples/Cleipnir.Samples.Console/WaitForMessages/Example.cs +++ b/Samples/Cleipnir.Samples.Console/WaitForMessages/Example.cs @@ -1,5 +1,6 @@ using Cleipnir.ResilientFunctions.Storage; using Microsoft.Extensions.DependencyInjection; +using Cleipnir.ResilientFunctions.Domain; namespace Cleipnir.Flows.Sample.ConsoleApp.WaitForMessages; @@ -12,8 +13,7 @@ public static async Task Do() var flowsContainer = new FlowsContainer( new InMemoryFunctionStore(), - serviceCollection.BuildServiceProvider(), - Options.Default + serviceCollection.BuildServiceProvider() ); var flows = new Flows(nameof(WaitForMessagesFlow), flowsContainer);