Overview
RCommon provides a unified event handling abstraction that works across multiple transport backends. The same ISubscriber interface is used whether events are dispatched in-process via the built-in event bus, fanned out through MediatR notifications, or routed over a message broker using MassTransit or Wolverine.
In-Memory Events
The in-memory event bus provides local publish/subscribe within a single process. Events are dispatched synchronously to all registered ISubscriber handlers within the same DI scope. No external infrastructure is required.
Distributed Events
Distributed event handling extends the in-process model to message brokers, enabling events to cross service boundaries. RCommon integrates with MassTransit and Wolverine as transport backends while keeping the application handler code identical to the in-memory case: every handler implements the same ISubscriber interface.
Transactional Outbox
The transactional outbox pattern guarantees that events are published to a message broker if and only if the database transaction that triggered them commits. RCommon provides outbox integration for both MassTransit and Wolverine.
MediatR
RCommon integrates with MediatR to route events through the MediatR notification pipeline. Each event is wrapped in a MediatRNotification and published to all registered INotificationHandler instances. From the application's perspective, handlers still implement ISubscriber — the MediatR plumbing is hidden behind the abstraction.
MassTransit
RCommon integrates with MassTransit to deliver events to consumers across service boundaries. The integration uses MassTransitEventHandler as a MassTransit IConsumer that delegates to the application's ISubscriber implementation. Application handler code has no dependency on MassTransit types.
Wolverine
RCommon integrates with Wolverine to deliver events both in-process and across service boundaries. The integration registers WolverineEventHandler as a Wolverine IWolverineHandler that delegates to the application's ISubscriber. Application handler code has no dependency on Wolverine types.