Skip to content

Commit

Permalink
Rename FilterHandler to HandlerFilter on EventMediationSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
litenova committed Nov 23, 2023
1 parent ca94d62 commit 56f9498
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<LangVersion>latest</LangVersion>
<Authors>A. Shafie</Authors>
<PackageTags>mediator;cqrs</PackageTags>
<VersionPrefix>0.18.3</VersionPrefix>
<VersionPrefix>0.18.4</VersionPrefix>
<PackageReleaseNotes>$([System.IO.File]::ReadAllText("$(SolutionDir)\Release-Notes.txt"))</PackageReleaseNotes>
<PackageIcon>icon.png</PackageIcon>
<Description>LiteBus is an easy-to-use and ambitious in-process mediator providing the foundation to implement Command Query Separation (CQS). It is implemented with minimal reflection and instead utilizes covariance and contravariance to provide its core functionality.</Description>
Expand Down
3 changes: 3 additions & 0 deletions Release-Notes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v.0.18.4
⦁ Rename `FilterHandler` to `HandlerFilter` on `EventMediationSettings` as it is more more concise and directly states that it is a filter for handlers.

v.0.18.3
⦁ Add `EventMediationSettings` to IEventMediator to allow configuring event mediation.
⦁ Add `FilterHandler` to `EventMediationSettings` to allow filtering event handlers.
Expand Down
2 changes: 1 addition & 1 deletion src/LiteBus.Events.Abstractions/EventMediationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ public sealed class EventMediationSettings
/// A function that takes a <see cref="Type"/> representing the event handler type
/// and returns a boolean indicating whether the handler should be invoked.
/// </value>
public Func<Type, bool> FilterHandler { get; init; } = _ => true;
public Func<Type, bool> HandlerFilter { get; init; } = _ => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public async Task Mediate(TMessage message, IMessageDependencies messageDependen
{
await messageDependencies.RunAsyncPreHandlers(message);

foreach (var lazyHandler in messageDependencies.Handlers.Where(x => _settings.FilterHandler(x.Descriptor.HandlerType)))
foreach (var lazyHandler in messageDependencies.Handlers.Where(x => _settings.HandlerFilter(x.Descriptor.HandlerType)))
{
await (Task) lazyHandler.Handler.Value.Handle(message);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/LiteBus.Events.UnitTests/EventModuleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public async Task MediatingWithFiltered_ProductCreatedEvent_ShouldGoThroughHandl
// Act
await eventMediator.PublishAsync(@event, new EventMediationSettings
{
FilterHandler = type => type.IsAssignableTo(typeof(IFilteredEventHandler))
HandlerFilter = type => type.IsAssignableTo(typeof(IFilteredEventHandler))
});

// Assert
Expand Down

0 comments on commit 56f9498

Please sign in to comment.