Skip to content

Commit

Permalink
Merge branch 'develop-v1' into issue/919/snapshot-upgrader-metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmus authored Mar 12, 2024
2 parents dfa7ffe + 7ca2db0 commit 8a3625b
Show file tree
Hide file tree
Showing 21 changed files with 230 additions and 356 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version:
3.1.x
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
2.1.x
Expand All @@ -37,12 +37,12 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -56,4 +56,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version:
3.1.x
Expand Down
34 changes: 19 additions & 15 deletions Documentation/basics/jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ parent: Basics
nav_order: 2
---

.. _jobs:
.. \_jobs:

# Jobs

Expand All @@ -16,8 +16,8 @@ provides basic functionality for jobs.
There are areas where you might find jobs very useful, here are some
examples

- Publish a command at a specific time in the future
- Transient error handling
- Publish a command at a specific time in the future
- Transient error handling

```csharp
var jobScheduler = resolver.Resolve<IJobScheduler>();
Expand All @@ -33,17 +33,16 @@ In the above example the `SendEmailCommand` command will be published
in seven days.

!!! attention
When working with jobs, you should be aware of the following
When working with jobs, you should be aware of the following

- The default implementation does executes the job *now* (completely ignoring `runAt`/`delay` parameters) and in the
current context. To get support for scheduled jobs, inject another implementation of `IJobScheduler`,
current context. To get support for scheduled jobs, inject another implementation of `IJobScheduler`,
e.g. by installing ``EventFlow.Hangfire`` (Read below for details).
- Your jobs should serialize to JSON properly, see the section on
`value objects <./ValueObjects.md>`__ for more information
- If you use the provided ``PublishCommandJob``, make sure that your
commands serialize properly as well


## Create your own jobs

To create your own jobs, your job merely needs to implement the `IJob`
Expand Down Expand Up @@ -77,7 +76,7 @@ version to EventFlow and this is how EventFlow distinguishes between the
different job types. This makes it possible for you to reorder your
code, even rename the job type. As long as you keep the same attribute
values it is considered the same job in EventFlow. If the attribute is
omitted, the name will be the type name and version will be ``1``.
omitted, the name will be the type name and version will be `1`.

Here's how the job is registered in EventFlow.

Expand All @@ -102,17 +101,22 @@ await jobScheduler.ScheduleAsync(

## Hangfire

To use `Hangfire <http://hangfire.io/>`__ as the job scheduler, install
the NuGet package ``EventFlow.Hangfire`` and configure EventFlow to use
To use `Hangfire <http://hangfire.io/>`\_\_ as the job scheduler, install
the NuGet package `EventFlow.Hangfire` and configure EventFlow to use
the scheduler like this.

hangfire supports several different storage solutions including Microsoft SQL Server and MongoDB. Use only inMemoryStorage for testing and development.

```csharp
var resolver = EventFlowOptions.new
.UseHangfireJobScheduler() // This line
...
.CreateResolver();
private void RegisterHangfire(IEventFlowOptions eventFlowOptions)
{
eventFlowOptions.ServiceCollection
.AddHangfire(c => c.UseInMemoryStorage())
.AddHangfireServer();
eventFlowOptions.UseHangfireJobScheduler();
}
```

!!! note
The `UseHangfireJobScheduler()` doesn't do any Hangfire
configuration, but merely registers the proper scheduler in EventFlow.
The `UseHangfireJobScheduler()` doesn't do any Hangfire
configuration, but merely registers the proper scheduler in EventFlow.
17 changes: 17 additions & 0 deletions EventFlow.sln
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.RabbitMQ", "Sourc
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.RabbitMQ.Tests", "Source\EventFlow.RabbitMQ.Tests\EventFlow.RabbitMQ.Tests.csproj", "{683BBF59-C81F-4E04-BE33-E8806B40F766}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Hangfire", "Hangfire", "{2E9CFB92-E8E5-4466-8410-CCB5BA5CB6D1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.Hangfire", "Source\EventFlow.Hangfire\EventFlow.Hangfire.csproj", "{8BC99846-DDDB-40E7-B062-308BF8A1239F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.Hangfire.Tests", "Source\EventFlow.Hangfire.Tests\EventFlow.Hangfire.Tests.csproj", "{B4247230-5289-4D17-BB0F-CB2FDBABA988}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -117,6 +123,14 @@ Global
{683BBF59-C81F-4E04-BE33-E8806B40F766}.Debug|Any CPU.Build.0 = Debug|Any CPU
{683BBF59-C81F-4E04-BE33-E8806B40F766}.Release|Any CPU.ActiveCfg = Release|Any CPU
{683BBF59-C81F-4E04-BE33-E8806B40F766}.Release|Any CPU.Build.0 = Release|Any CPU
{8BC99846-DDDB-40E7-B062-308BF8A1239F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8BC99846-DDDB-40E7-B062-308BF8A1239F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8BC99846-DDDB-40E7-B062-308BF8A1239F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8BC99846-DDDB-40E7-B062-308BF8A1239F}.Release|Any CPU.Build.0 = Release|Any CPU
{B4247230-5289-4D17-BB0F-CB2FDBABA988}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B4247230-5289-4D17-BB0F-CB2FDBABA988}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B4247230-5289-4D17-BB0F-CB2FDBABA988}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B4247230-5289-4D17-BB0F-CB2FDBABA988}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -141,6 +155,9 @@ Global
{CE1D5F5A-B348-423E-9B5E-1A805BFB199F} = {5EE323DE-E69B-451A-8AC3-22DD6A004FBA}
{9B807641-8566-4382-AF8B-445D074105AD} = {CE1D5F5A-B348-423E-9B5E-1A805BFB199F}
{683BBF59-C81F-4E04-BE33-E8806B40F766} = {CE1D5F5A-B348-423E-9B5E-1A805BFB199F}
{2E9CFB92-E8E5-4466-8410-CCB5BA5CB6D1} = {5EE323DE-E69B-451A-8AC3-22DD6A004FBA}
{8BC99846-DDDB-40E7-B062-308BF8A1239F} = {2E9CFB92-E8E5-4466-8410-CCB5BA5CB6D1}
{B4247230-5289-4D17-BB0F-CB2FDBABA988} = {2E9CFB92-E8E5-4466-8410-CCB5BA5CB6D1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {17607E2C-4E8E-45A2-85BD-0A5808E1C0F3}
Expand Down
16 changes: 6 additions & 10 deletions Source/EventFlow.Hangfire.Tests/EventFlow.Hangfire.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../Common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
<IsPackable>False</IsPackable>
</PropertyGroup>

<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Hangfire.SqlServer" Version="1.6.20" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="Hangfire.InMemory" Version="0.7" />
<PackageReference Include="Hangfire.NetCore" Version="1.8.10" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
</ItemGroup>
<ItemGroup>
Expand Down
Loading

0 comments on commit 8a3625b

Please sign in to comment.