Hi
I got a MassTransit middleware that to persist all events into an event store, currently all events implement interface `IEvent`, here is my middleware
public async Task Send(T context, IPipe<T> next)
{
if (context is PublishContext<IEvent> publishContext)
{
await _eventService.InsertAsync(publishContext.Message);
}
await next.Send(context);
}
My problem is Send is being called multiple times depends on the interface implemented by the event itself, looks like GreenPipe will hookup a pipe for each implemented interface, so how do I just handle the event once?
Thanks