Skip to content

Commit

Permalink
Updated Options into using latest version from ResilientFunctions
Browse files Browse the repository at this point in the history
  • Loading branch information
stidsborg committed Jun 30, 2024
1 parent 386e253 commit af86f0c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 24 deletions.
12 changes: 7 additions & 5 deletions Cleipnir.Flows/FlowsContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ public FlowsContainer(IFunctionStore flowStore, IServiceProvider serviceProvider
var logger = serviceProvider.GetRequiredService<ILogger>();
options = new Options(
unhandledExceptionHandler: excp => logger.LogError(excp, "Unhandled exception in Cleipnir Flows"),
options.CrashedCheckFrequency,
options.PostponedCheckFrequency,
options.TimeoutCheckFrequency,
options.EventSourcePullFrequency,
options.RetentionPeriod,
options.RetentionCleanUpFrequency,
options.LeaseLength,
options.EnableWatchdogs,
options.WatchdogCheckFrequency,
options.MessagesPullFrequency,
options.DelayStartup,
options.MaxParallelRetryInvocations,
options.Serializer
Expand All @@ -40,7 +42,7 @@ public FlowsContainer(IFunctionStore flowStore, IServiceProvider serviceProvider
.Select(m => m switch
{
MiddlewareInstance middlewareInstance => middlewareInstance.Middleware,
MiddlewareType middlewareType => (IMiddleware)serviceProvider.GetRequiredService(middlewareType.Type),
MiddlewareType middlewareType => (IMiddleware) serviceProvider.GetRequiredService(middlewareType.Type),
_ => throw new ArgumentOutOfRangeException(nameof(m))
})
.ToList();
Expand Down
48 changes: 30 additions & 18 deletions Cleipnir.Flows/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,43 @@ public class Options
public static Options Default { get; } = new();

internal Action<RFunctionException>? UnhandledExceptionHandler { get; }
internal TimeSpan? CrashedCheckFrequency { get; }
internal TimeSpan? PostponedCheckFrequency { get; }
internal TimeSpan? TimeoutCheckFrequency { get; }
internal TimeSpan? EventSourcePullFrequency { get; }
internal TimeSpan? RetentionPeriod { get; }
internal TimeSpan? RetentionCleanUpFrequency { get; }
internal TimeSpan? LeaseLength { get; }
internal bool? EnableWatchdogs { get; }
internal TimeSpan? WatchdogCheckFrequency { get; }
internal TimeSpan? DelayStartup { get; }
internal int? MaxParallelRetryInvocations { get; }
internal TimeSpan? MessagesPullFrequency { get; }
internal ISerializer? Serializer { get; }
internal IEnumerable<RoutingInformation>? Routes { get; }
internal List<MiddlewareInstanceOrType> Middlewares { get; } = new();

public Options(
Action<RFunctionException>? unhandledExceptionHandler = null,
TimeSpan? crashedCheckFrequency = null,
TimeSpan? postponedCheckFrequency = null,
TimeSpan? timeoutCheckFrequency = null,
TimeSpan? eventSourcePullFrequency = null,
TimeSpan? retentionPeriod = null,
TimeSpan? retentionCleanUpFrequency = null,
TimeSpan? leaseLength = null,
bool? enableWatchdogs = null,
TimeSpan? watchdogCheckFrequency = null,
TimeSpan? messagesPullFrequency = null,
TimeSpan? delayStartup = null,
int? maxParallelRetryInvocations = null,
ISerializer? serializer = null
ISerializer? serializer = null,
IEnumerable<RoutingInformation>? routes = null
)
{
UnhandledExceptionHandler = unhandledExceptionHandler;
CrashedCheckFrequency = crashedCheckFrequency;
PostponedCheckFrequency = postponedCheckFrequency;
TimeoutCheckFrequency = timeoutCheckFrequency;
EventSourcePullFrequency = eventSourcePullFrequency;
WatchdogCheckFrequency = watchdogCheckFrequency;
LeaseLength = leaseLength;
RetentionPeriod = retentionPeriod;
RetentionCleanUpFrequency = retentionCleanUpFrequency;
EnableWatchdogs = enableWatchdogs;
MessagesPullFrequency = messagesPullFrequency;
DelayStartup = delayStartup;
MaxParallelRetryInvocations = maxParallelRetryInvocations;
Serializer = serializer;
Routes = routes;
}

public Options UseMiddleware<TMiddleware>() where TMiddleware : IMiddleware
Expand All @@ -57,12 +66,15 @@ public Options UseMiddleware(IMiddleware middleware)
internal Settings MapToRFunctionsSettings()
=> new(
UnhandledExceptionHandler,
CrashedCheckFrequency,
PostponedCheckFrequency,
TimeoutCheckFrequency,
EventSourcePullFrequency,
RetentionPeriod,
RetentionCleanUpFrequency,
LeaseLength,
EnableWatchdogs,
WatchdogCheckFrequency,
MessagesPullFrequency,
DelayStartup,
MaxParallelRetryInvocations,
Serializer
Serializer,
Routes
);
}
2 changes: 1 addition & 1 deletion Cleipnir.ResilientFunctions
Submodule Cleipnir.ResilientFunctions updated 23 files
+2 −2 Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/SunshineTests.cs
+1 −1 Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/ControlPanelTests.cs
+7 −8 Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/CrashedTests.cs
+4 −4 Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/DoubleInvocationTests.cs
+4 −4 Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/FailedTests.cs
+6 −6 Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/PostponedTests.cs
+7 −7 Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/ReInvocationTests.cs
+4 −4 Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/ScheduleReInvocationTests.cs
+38 −12 Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/SunshineTests.cs
+0 −7 Core/Cleipnir.ResilientFunctions/CoreRuntime/Invocation/InvocationMode.cs
+4 −4 Core/Cleipnir.ResilientFunctions/CoreRuntime/Watchdogs/CrashedWatchdog.cs
+4 −4 Core/Cleipnir.ResilientFunctions/CoreRuntime/Watchdogs/PostponedWatchdog.cs
+24 −5 Core/Cleipnir.ResilientFunctions/CoreRuntime/Watchdogs/ReInvoker.cs
+4 −4 Core/Cleipnir.ResilientFunctions/CoreRuntime/Watchdogs/ReInvokerFactory.cs
+4 −4 Core/Cleipnir.ResilientFunctions/CoreRuntime/Watchdogs/RetentionWatchdog.cs
+8 −5 Core/Cleipnir.ResilientFunctions/CoreRuntime/Watchdogs/WatchDogsFactory.cs
+13 −1 Core/Cleipnir.ResilientFunctions/Domain/Settings.cs
+5 −2 Samples/Sample.ConsoleApp/Program.cs
+35 −3 Samples/Sample.ConsoleApp/TravelAgency/Example.cs
+2 −2 Samples/Sample.ConsoleApp/TravelAgency/Saga.cs
+2 −2 Stores/MySQL/Cleipnir.ResilientFunctions.MySQL.Tests/RFunctionTests/SunshineTests.cs
+3 −3 Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/RFunctionTests/SunshineTests.cs
+2 −3 Stores/SqlServer/Cleipnir.ResilientFunctions.SqlServer.Tests/RFunctionTests/SunshineTests.cs

0 comments on commit af86f0c

Please sign in to comment.