-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* EventRouter Updates * Updated dependencies to latest and fixed MassTransit example. * Updated MassTransit test projects. * Promoted EventHandling assembly to RCommon.Core as it is becoming more essential to have loosely coupled events locally in RCommon as well as in dependencies! * Removed deprecated project. * Feature/v2 unit testing (#114) * Changing strategy for entity event tracking. * Removed old icon. Updated EventRouter to allow for parameterized events to be passed in but also stored like a repository. * Updated entity event tracking to enforce better async capabilities. Version bump. * Feature/mediator enhancements (#117) * Removed unneeded samples/files. Renamed existing examples. * Removed DistributedUnitOfWorkBehavior as it is no longer neccesary. The IEntityEventTracker leverages IEventRouter to emit transactional events so we don't need to emit from UoW. * Refactored MediatRNotificationHandler so that events no longer need to implement INotification - only ISerializable which is generic across mulitple types of eventing libraries. * Added ability to send through mediator rather than just publish. * Added Mediator abstraction with MediatR implementation. * Simplified MediatR config. * Added MediatR Request/Notification handling and refactored event handling. * Added Mediator Request with response for MediatR implementation. * Version bump. Co-authored-by: Jason Webb <jason.webb@leadventure.com>
- Loading branch information
1 parent
ea2cee6
commit b1a17be
Showing
101 changed files
with
901 additions
and
930 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
Examples/EventHandling/Examples.EventHandling.MediatR/TestEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 0 additions & 32 deletions
32
Examples/EventSourcing/Samples.EventSourcing.EventFlow/MyAggregate.cs
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
Examples/EventSourcing/Samples.EventSourcing.EventFlow/MyCountEvent.cs
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
Examples/EventSourcing/Samples.EventSourcing.EventFlow/MyId.cs
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
Examples/EventSourcing/Samples.EventSourcing.EventFlow/MyState.cs
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
Examples/EventSourcing/Samples.EventSourcing.EventFlow/Program.cs
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
...ples/EventSourcing/Samples.EventSourcing.EventFlow/Samples.EventSourcing.EventFlow.csproj
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
Examples/Mediator/Examples.Mediator.MediatR/ConfigurationContainer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Microsoft.Extensions.Configuration; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Examples.Mediator.MediatR | ||
{ | ||
internal static class ConfigurationContainer | ||
{ | ||
public static IConfiguration Configuration { get; set; } | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
Examples/Mediator/Examples.Mediator.MediatR/Examples.Mediator.MediatR.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\Src\RCommon.Core\RCommon.Core.csproj" /> | ||
<ProjectReference Include="..\..\..\Src\RCommon.Mediatr\RCommon.MediatR.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
| ||
using Examples.Mediator.MediatR; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using RCommon; | ||
using RCommon.EventHandling.Producers; | ||
using RCommon.Mediator; | ||
using RCommon.Mediator.MediatR; | ||
using RCommon.MediatR; | ||
using RCommon.MediatR.Producers; | ||
using System.Diagnostics; | ||
using System.Reflection; | ||
using static System.Net.Mime.MediaTypeNames; | ||
|
||
try | ||
{ | ||
var host = Host.CreateDefaultBuilder(args) | ||
.ConfigureAppConfiguration((context, builder) => | ||
{ | ||
|
||
ConfigurationContainer.Configuration = builder | ||
.Build(); | ||
}) | ||
.ConfigureServices(services => | ||
{ | ||
// Configure RCommon | ||
services.AddRCommon() | ||
.WithMediator<MediatRBuilder>(mediator => | ||
{ | ||
mediator.AddNotification<TestNotification, TestNotificationHandler>(); | ||
mediator.AddRequest<TestRequest, TestRequestHandler>(); | ||
mediator.AddRequest<TestRequest, TestResponse, TestRequestHandlerWithResponse>(); | ||
|
||
// Additional configurations can be set like below | ||
mediator.Configure(config => | ||
{ | ||
config.RegisterServicesFromAssemblies((typeof(Program).GetTypeInfo().Assembly)); | ||
}); | ||
}); | ||
|
||
}).Build(); | ||
|
||
Console.WriteLine("Example Starting"); | ||
var mediatorService = host.Services.GetService<IMediatorService>(); | ||
var notification = new TestNotification(DateTime.Now, Guid.NewGuid()); | ||
var request = new TestRequest(DateTime.Now, Guid.NewGuid()); | ||
|
||
await mediatorService.Publish(notification); // For multiple handlers | ||
await mediatorService.Send(request); // For a single endpoint | ||
|
||
var response = await mediatorService.Send<TestRequest, TestResponse>(request); // For a single endpoint with a response | ||
Console.WriteLine("Response: {0}", response.Message); | ||
|
||
Console.WriteLine("Example Complete"); | ||
Console.ReadLine(); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine(ex.ToString()); | ||
|
||
} | ||
|
Oops, something went wrong.