Skip to content

Commit

Permalink
refactor: register event types explicitly now they're in another asse…
Browse files Browse the repository at this point in the history
…mbly
  • Loading branch information
koenmetsu committed Jan 8, 2025
1 parent ceefc2e commit 79e7302
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace AssociationRegistry.Admin.Api.Infrastructure.Extensions;

using Adapters.VCodeGeneration;
using Events;
using Formats;
using GrarConsumer;
using GrarConsumer.Kafka;
Expand All @@ -20,6 +21,7 @@
using Vereniging;
using Weasel.Core;
using Wolverine.Marten;
using IEvent = Events.IEvent;

public static class MartenExtensions
{
Expand Down Expand Up @@ -54,6 +56,12 @@ public static IServiceCollection AddMarten(
opts.Events.MetadataConfig.EnableAll();
opts.Events.AppendMode = isDevelopment ? EventAppendMode.Rich : EventAppendMode.Quick;

opts.Events.AddEventTypes( typeof(IEvent).Assembly
.GetTypes()
.Where(t => typeof(IEvent)
.IsAssignableFrom(t) && !t.IsAbstract && t.IsClass)
.ToList());

opts.Listeners.Add(
new HighWatermarkListener(serviceProvider.GetRequiredService<Instrumentation>()));

Expand Down

0 comments on commit 79e7302

Please sign in to comment.