Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to scheduler message #3487

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions Brighter.sln
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,30 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Salutation_Sweeper", "sampl
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Paramore.Brighter.Locking.MsSql", "src\Paramore.Brighter.Locking.MsSql\Paramore.Brighter.Locking.MsSql.csproj", "{758EE237-C722-4A0A-908C-2D08C1E59025}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Paramore.Brighter.MessageScheduler.Quartz", "src\Paramore.Brighter.MessageScheduler.Quartz\Paramore.Brighter.MessageScheduler.Quartz.csproj", "{097CB927-EC20-413A-85C9-61E6380814CA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ParamoreBrighter.Quartz.Tests", "tests\ParamoreBrighter.Quartz.Tests\ParamoreBrighter.Quartz.Tests.csproj", "{4469AEE3-B460-4948-A0A5-B9480EE70EA4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Paramore.Brighter.MessageScheduler.Aws", "src\Paramore.Brighter.MessageScheduler.Aws\Paramore.Brighter.MessageScheduler.Aws.csproj", "{28C2529C-EF15-4C86-A2CC-9EE326423A77}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scheduler", "Scheduler", "{8E414D7F-8DF0-4608-B47C-19213DB7E2B0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Quartz", "Quartz", "{D5F5A100-F524-4020-B157-298EDC0910F4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreetingsReceiverConsole", "samples\Scheduler\QuartzTaskQueue\GreetingsReceiverConsole\GreetingsReceiverConsole.csproj", "{3779A9C1-2E47-4CB4-B569-75752CA8C419}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreetingsPumper", "samples\Scheduler\QuartzTaskQueue\GreetingsPumper\GreetingsPumper.csproj", "{FADD3869-F9A1-41EA-8DB2-04AFB61A6635}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Greetings", "samples\Scheduler\QuartzTaskQueue\Greetings\Greetings.csproj", "{50A08BF4-7B24-42EF-B1EA-3CB9546EB8AE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Aws", "Aws", "{966314C4-D989-4E50-85C4-8091189495E9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Greetings", "samples\Scheduler\AwsTaskQueue\Greetings\Greetings.csproj", "{85AB9510-93CC-4D10-A179-A30654765E59}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreetingsPumper", "samples\Scheduler\AwsTaskQueue\GreetingsPumper\GreetingsPumper.csproj", "{5C27F959-455A-408C-8248-D7EC848B633E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreetingsReceiverConsole", "samples\Scheduler\AwsTaskQueue\GreetingsReceiverConsole\GreetingsReceiverConsole.csproj", "{F8A3AE7E-B232-4794-B23F-772F48D8636F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1765,6 +1789,114 @@ Global
{758EE237-C722-4A0A-908C-2D08C1E59025}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{758EE237-C722-4A0A-908C-2D08C1E59025}.Release|x86.ActiveCfg = Release|Any CPU
{758EE237-C722-4A0A-908C-2D08C1E59025}.Release|x86.Build.0 = Release|Any CPU
{097CB927-EC20-413A-85C9-61E6380814CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{097CB927-EC20-413A-85C9-61E6380814CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{097CB927-EC20-413A-85C9-61E6380814CA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{097CB927-EC20-413A-85C9-61E6380814CA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{097CB927-EC20-413A-85C9-61E6380814CA}.Debug|x86.ActiveCfg = Debug|Any CPU
{097CB927-EC20-413A-85C9-61E6380814CA}.Debug|x86.Build.0 = Debug|Any CPU
{097CB927-EC20-413A-85C9-61E6380814CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{097CB927-EC20-413A-85C9-61E6380814CA}.Release|Any CPU.Build.0 = Release|Any CPU
{097CB927-EC20-413A-85C9-61E6380814CA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{097CB927-EC20-413A-85C9-61E6380814CA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{097CB927-EC20-413A-85C9-61E6380814CA}.Release|x86.ActiveCfg = Release|Any CPU
{097CB927-EC20-413A-85C9-61E6380814CA}.Release|x86.Build.0 = Release|Any CPU
{4469AEE3-B460-4948-A0A5-B9480EE70EA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4469AEE3-B460-4948-A0A5-B9480EE70EA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4469AEE3-B460-4948-A0A5-B9480EE70EA4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{4469AEE3-B460-4948-A0A5-B9480EE70EA4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{4469AEE3-B460-4948-A0A5-B9480EE70EA4}.Debug|x86.ActiveCfg = Debug|Any CPU
{4469AEE3-B460-4948-A0A5-B9480EE70EA4}.Debug|x86.Build.0 = Debug|Any CPU
{4469AEE3-B460-4948-A0A5-B9480EE70EA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4469AEE3-B460-4948-A0A5-B9480EE70EA4}.Release|Any CPU.Build.0 = Release|Any CPU
{4469AEE3-B460-4948-A0A5-B9480EE70EA4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{4469AEE3-B460-4948-A0A5-B9480EE70EA4}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{4469AEE3-B460-4948-A0A5-B9480EE70EA4}.Release|x86.ActiveCfg = Release|Any CPU
{4469AEE3-B460-4948-A0A5-B9480EE70EA4}.Release|x86.Build.0 = Release|Any CPU
{28C2529C-EF15-4C86-A2CC-9EE326423A77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{28C2529C-EF15-4C86-A2CC-9EE326423A77}.Debug|Any CPU.Build.0 = Debug|Any CPU
{28C2529C-EF15-4C86-A2CC-9EE326423A77}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{28C2529C-EF15-4C86-A2CC-9EE326423A77}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{28C2529C-EF15-4C86-A2CC-9EE326423A77}.Debug|x86.ActiveCfg = Debug|Any CPU
{28C2529C-EF15-4C86-A2CC-9EE326423A77}.Debug|x86.Build.0 = Debug|Any CPU
{28C2529C-EF15-4C86-A2CC-9EE326423A77}.Release|Any CPU.ActiveCfg = Release|Any CPU
{28C2529C-EF15-4C86-A2CC-9EE326423A77}.Release|Any CPU.Build.0 = Release|Any CPU
{28C2529C-EF15-4C86-A2CC-9EE326423A77}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{28C2529C-EF15-4C86-A2CC-9EE326423A77}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{28C2529C-EF15-4C86-A2CC-9EE326423A77}.Release|x86.ActiveCfg = Release|Any CPU
{28C2529C-EF15-4C86-A2CC-9EE326423A77}.Release|x86.Build.0 = Release|Any CPU
{3779A9C1-2E47-4CB4-B569-75752CA8C419}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3779A9C1-2E47-4CB4-B569-75752CA8C419}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3779A9C1-2E47-4CB4-B569-75752CA8C419}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{3779A9C1-2E47-4CB4-B569-75752CA8C419}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{3779A9C1-2E47-4CB4-B569-75752CA8C419}.Debug|x86.ActiveCfg = Debug|Any CPU
{3779A9C1-2E47-4CB4-B569-75752CA8C419}.Debug|x86.Build.0 = Debug|Any CPU
{3779A9C1-2E47-4CB4-B569-75752CA8C419}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3779A9C1-2E47-4CB4-B569-75752CA8C419}.Release|Any CPU.Build.0 = Release|Any CPU
{3779A9C1-2E47-4CB4-B569-75752CA8C419}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{3779A9C1-2E47-4CB4-B569-75752CA8C419}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{3779A9C1-2E47-4CB4-B569-75752CA8C419}.Release|x86.ActiveCfg = Release|Any CPU
{3779A9C1-2E47-4CB4-B569-75752CA8C419}.Release|x86.Build.0 = Release|Any CPU
{FADD3869-F9A1-41EA-8DB2-04AFB61A6635}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FADD3869-F9A1-41EA-8DB2-04AFB61A6635}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FADD3869-F9A1-41EA-8DB2-04AFB61A6635}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{FADD3869-F9A1-41EA-8DB2-04AFB61A6635}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{FADD3869-F9A1-41EA-8DB2-04AFB61A6635}.Debug|x86.ActiveCfg = Debug|Any CPU
{FADD3869-F9A1-41EA-8DB2-04AFB61A6635}.Debug|x86.Build.0 = Debug|Any CPU
{FADD3869-F9A1-41EA-8DB2-04AFB61A6635}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FADD3869-F9A1-41EA-8DB2-04AFB61A6635}.Release|Any CPU.Build.0 = Release|Any CPU
{FADD3869-F9A1-41EA-8DB2-04AFB61A6635}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{FADD3869-F9A1-41EA-8DB2-04AFB61A6635}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{FADD3869-F9A1-41EA-8DB2-04AFB61A6635}.Release|x86.ActiveCfg = Release|Any CPU
{FADD3869-F9A1-41EA-8DB2-04AFB61A6635}.Release|x86.Build.0 = Release|Any CPU
{50A08BF4-7B24-42EF-B1EA-3CB9546EB8AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{50A08BF4-7B24-42EF-B1EA-3CB9546EB8AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{50A08BF4-7B24-42EF-B1EA-3CB9546EB8AE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{50A08BF4-7B24-42EF-B1EA-3CB9546EB8AE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{50A08BF4-7B24-42EF-B1EA-3CB9546EB8AE}.Debug|x86.ActiveCfg = Debug|Any CPU
{50A08BF4-7B24-42EF-B1EA-3CB9546EB8AE}.Debug|x86.Build.0 = Debug|Any CPU
{50A08BF4-7B24-42EF-B1EA-3CB9546EB8AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50A08BF4-7B24-42EF-B1EA-3CB9546EB8AE}.Release|Any CPU.Build.0 = Release|Any CPU
{50A08BF4-7B24-42EF-B1EA-3CB9546EB8AE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{50A08BF4-7B24-42EF-B1EA-3CB9546EB8AE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{50A08BF4-7B24-42EF-B1EA-3CB9546EB8AE}.Release|x86.ActiveCfg = Release|Any CPU
{50A08BF4-7B24-42EF-B1EA-3CB9546EB8AE}.Release|x86.Build.0 = Release|Any CPU
{85AB9510-93CC-4D10-A179-A30654765E59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{85AB9510-93CC-4D10-A179-A30654765E59}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85AB9510-93CC-4D10-A179-A30654765E59}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{85AB9510-93CC-4D10-A179-A30654765E59}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{85AB9510-93CC-4D10-A179-A30654765E59}.Debug|x86.ActiveCfg = Debug|Any CPU
{85AB9510-93CC-4D10-A179-A30654765E59}.Debug|x86.Build.0 = Debug|Any CPU
{85AB9510-93CC-4D10-A179-A30654765E59}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85AB9510-93CC-4D10-A179-A30654765E59}.Release|Any CPU.Build.0 = Release|Any CPU
{85AB9510-93CC-4D10-A179-A30654765E59}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{85AB9510-93CC-4D10-A179-A30654765E59}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{85AB9510-93CC-4D10-A179-A30654765E59}.Release|x86.ActiveCfg = Release|Any CPU
{85AB9510-93CC-4D10-A179-A30654765E59}.Release|x86.Build.0 = Release|Any CPU
{5C27F959-455A-408C-8248-D7EC848B633E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C27F959-455A-408C-8248-D7EC848B633E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C27F959-455A-408C-8248-D7EC848B633E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{5C27F959-455A-408C-8248-D7EC848B633E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{5C27F959-455A-408C-8248-D7EC848B633E}.Debug|x86.ActiveCfg = Debug|Any CPU
{5C27F959-455A-408C-8248-D7EC848B633E}.Debug|x86.Build.0 = Debug|Any CPU
{5C27F959-455A-408C-8248-D7EC848B633E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C27F959-455A-408C-8248-D7EC848B633E}.Release|Any CPU.Build.0 = Release|Any CPU
{5C27F959-455A-408C-8248-D7EC848B633E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{5C27F959-455A-408C-8248-D7EC848B633E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{5C27F959-455A-408C-8248-D7EC848B633E}.Release|x86.ActiveCfg = Release|Any CPU
{5C27F959-455A-408C-8248-D7EC848B633E}.Release|x86.Build.0 = Release|Any CPU
{F8A3AE7E-B232-4794-B23F-772F48D8636F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F8A3AE7E-B232-4794-B23F-772F48D8636F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F8A3AE7E-B232-4794-B23F-772F48D8636F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{F8A3AE7E-B232-4794-B23F-772F48D8636F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{F8A3AE7E-B232-4794-B23F-772F48D8636F}.Debug|x86.ActiveCfg = Debug|Any CPU
{F8A3AE7E-B232-4794-B23F-772F48D8636F}.Debug|x86.Build.0 = Debug|Any CPU
{F8A3AE7E-B232-4794-B23F-772F48D8636F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F8A3AE7E-B232-4794-B23F-772F48D8636F}.Release|Any CPU.Build.0 = Release|Any CPU
{F8A3AE7E-B232-4794-B23F-772F48D8636F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{F8A3AE7E-B232-4794-B23F-772F48D8636F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{F8A3AE7E-B232-4794-B23F-772F48D8636F}.Release|x86.ActiveCfg = Release|Any CPU
{F8A3AE7E-B232-4794-B23F-772F48D8636F}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1862,6 +1994,16 @@ Global
{915BD9FD-2E29-4E2B-8DA3-A74055F32A20} = {C6B17EFD-4F05-4D45-AF3E-C4F3F790B994}
{7D8CE752-CCBB-4868-ADF0-30FF94CA611C} = {11935469-A062-4CFF-9F72-F4F41E14C2B4}
{FBAF452E-C0AB-4C4B-9A81-F1ED9616DE2A} = {202BA107-89D5-4868-AC5A-3527114C0109}
{4469AEE3-B460-4948-A0A5-B9480EE70EA4} = {329736D2-BF92-4D06-A7BF-19F4B6B64EDD}
{8E414D7F-8DF0-4608-B47C-19213DB7E2B0} = {235DE1F1-E71B-4817-8E27-3B34FF006E4C}
{D5F5A100-F524-4020-B157-298EDC0910F4} = {8E414D7F-8DF0-4608-B47C-19213DB7E2B0}
{3779A9C1-2E47-4CB4-B569-75752CA8C419} = {D5F5A100-F524-4020-B157-298EDC0910F4}
{FADD3869-F9A1-41EA-8DB2-04AFB61A6635} = {D5F5A100-F524-4020-B157-298EDC0910F4}
{50A08BF4-7B24-42EF-B1EA-3CB9546EB8AE} = {D5F5A100-F524-4020-B157-298EDC0910F4}
{966314C4-D989-4E50-85C4-8091189495E9} = {8E414D7F-8DF0-4608-B47C-19213DB7E2B0}
{85AB9510-93CC-4D10-A179-A30654765E59} = {966314C4-D989-4E50-85C4-8091189495E9}
{5C27F959-455A-408C-8248-D7EC848B633E} = {966314C4-D989-4E50-85C4-8091189495E9}
{F8A3AE7E-B232-4794-B23F-772F48D8636F} = {966314C4-D989-4E50-85C4-8091189495E9}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8B7C7E31-2E32-4E0D-9426-BC9AF22E9F4C}
Expand Down
5 changes: 5 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<ItemGroup>
<PackageVersion Include="AWSSDK.DynamoDBv2" Version="3.7.405.15" />
<PackageVersion Include="AWSSDK.Extensions.NETCore.Setup" Version="3.7.301" />
<PackageVersion Include="AWSSDK.IdentityManagement" Version="3.7.404" />
<PackageVersion Include="AWSSDK.Scheduler" Version="3.7.400.88" />
<PackageVersion Include="AWSSDK.S3" Version="3.7.413.3" />
<PackageVersion Include="AWSSDK.SecurityToken" Version="3.7.401.37" />
<PackageVersion Include="AWSSDK.SimpleNotificationService" Version="3.7.400.88" />
Expand Down Expand Up @@ -78,6 +80,9 @@
<PackageVersion Include="Polly" Version="8.5.2" />
<PackageVersion Include="Polly.Contrib.WaitAndRetry" Version="1.1.1" />
<PackageVersion Include="Polly.Extensions.Http" Version="3.0.0" />
<PackageVersion Include="Quartz" Version="3.13.1" />
<PackageVersion Include="Quartz.Extensions.DependencyInjection" Version="3.13.1" />
<PackageVersion Include="Quartz.Extensions.Hosting" Version="3.13.1" />
<PackageVersion Include="RabbitMQ.Client" Version="7.0.0" />
<PackageVersion Include="Serilog" Version="4.2.0" />
<PackageVersion Include="Serilog.Extensions.Hosting" Version="9.0.0" />
Expand Down
3 changes: 2 additions & 1 deletion docker-compose-localstack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ services:
image: localstack/localstack
environment:
# LocalStack configuration: https://docs.localstack.cloud/references/configuration/
- "SERVICES=s3,sqs,sns,sts,dynamodb"
- "SERVICES=s3,sqs,sns,sts,dynamodb,iam,scheduler"
- "DEFAULT_REGION=eu-west-1"
- "DEBUG=1"
- "PROVIDER_OVERRIDE_EVENTS=v2"
ports:
- "4566:4566" # LocalStack Gateway
- "4510-4559:4510-4559" # External services port range
Expand Down
89 changes: 89 additions & 0 deletions docs/adr/0024-Scheduling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# 24. Scoping dependencies inline with lifetime scope

Date: 2025-01-20

## Status

Proposed

## Context

Adding the ability to schedule message (by providing `TimeSpan` or `DateTimeOffset`) give to user flexibility to `Send`, `Publis` and `Post`.



## Decision

Giving support to schedule message, it's necessary breaking on `IAmACommandProcessor` by adding these methods:

```c#
public interface IAmACommandProcessor
{
string SchedulerSend<TRequest>(TimeSpan delay, TRequest request) where TRequest : class, IRequest;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we would be better off overloading Send with a time, than adding a new name here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, how about SendAt, PublishAt, PostAt etc.

string SchedulerSend<TRequest>(DateTimeOffset delay, TRequest request) where TRequest : class, IRequest;
Task<string> SchedulerSendAsync<TRequest>(TimeSpan delay, TRequest request, bool continueOnCapturedContext = true, CancellationToken cancellationToken = default) where TRequest : class, IRequest;
Task<string> SchedulerSendAsync<TRequest>(DateTimeOffset delay, TRequest request, bool continueOnCapturedContext = true, CancellationToken cancellationToken = default) where TRequest : class, IRequest;

string SchedulerPublish<TRequest>(TimeSpan delay, TRequest request) where TRequest : class, IRequest;
string SchedulerPublish<TRequest>(DateTimeOffset delay, TRequest request) where TRequest : class, IRequest;
Task<string> SchedulerPublishAsync<TRequest>(TimeSpan delay, TRequest request, bool continueOnCapturedContext = true, CancellationToken cancellationToken = default) where TRequest : class, IRequest;
Task<string> SchedulerPublishsync<TRequest>(DateTimeOffset delay, TRequest request, bool continueOnCapturedContext = true, CancellationToken cancellationToken = default) where TRequest : class, IRequest;

string SchedulerPost<TRequest>(TimeSpan delay, TRequest request) where TRequest : class, IRequest;
string SchedulerPost<TRequest>(DateTimeOffset delay, TRequest request) where TRequest : class, IRequest;
Task<string> SchedulerPostAsync<TRequest>(TimeSpan delay, TRequest request, bool continueOnCapturedContext = true, CancellationToken cancellationToken = default) where TRequest : class, IRequest;
Task<string> SchedulerPostAsync<TRequest>(DateTimeOffset delay, TRequest request, bool continueOnCapturedContext = true, CancellationToken cancellationToken = default) where TRequest : class, IRequest;
}
```

Scheduling can be break into 2 part (Producer & Consumer):
- Producer -> Producing a message we are going to have a new interface:

```c#
public interface IAmAMessageScheduler
{
}


public interface IAmAMessageSchedulerAsync : IAmAMessageScheduler, IDisposable
{
Task<string> ScheduleAsync<TRequest>(DateTimeOffset at, SchedulerFireType fireType, TRequest request, CancellationToken cancellationToken = default) where TRequest : class, IRequest;
Task<string> ScheduleAsync<TRequest>(TimeSpan delay, SchedulerFireType fireType, TRequest request, CancellationToken cancellationToken = default) where TRequest : class, IRequest;
Task CancelSchedulerAsync(string id, CancellationToken cancellationToken = default);
}


public interface IAmAMessageSchedulerSync : IAmAMessageScheduler, IDisposable
{
string Schedule<TRequest>(DateTimeOffset at, SchedulerFireType fireType, TRequest request) where TRequest : class, IRequest;
string Schedule<TRequest>(TimeSpan delay, SchedulerFireType fireType, TRequest request) where TRequest : class, IRequest;
void CancelScheduler(string id);
}
```

- Consumer -> To avoid duplication code we are going to introduce a new message and have a handler for that:

```c#
public class SchedulerMessageFired : Event
{
.....
}


public class SchedulerMessageFiredHandlerAsync(IAmACommandProcessor processor) : RequestHandlerAsync<SchedulerMessageFired>
{
....
}
```

So on Scheduler implementation we need to send the SchedulerMessageFired

```c#
public class JobExecute(IAmACommandProcessor processor)
{
public async Task ExecuteAsync(Arg arg)
{
await processor.SendAsync(new SchedulerMessageFired{ ... });
}
}
```
15 changes: 15 additions & 0 deletions samples/Scheduler/AwsTaskQueue/Greetings/Greetings.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\src\Paramore.Brighter.MessagingGateway.AWSSQS\Paramore.Brighter.MessagingGateway.AWSSQS.csproj" />
<ProjectReference Include="..\..\..\..\src\Paramore.Brighter\Paramore.Brighter.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="System.Reflection.TypeExtensions" />
</ItemGroup>
</Project>
Loading
Loading