Class RabbitMqEventBus<TMarker>
- Assembly
- Savvyio.Extensions.DependencyInjection.RabbitMQ.dll
Provides a default implementation of the RabbitMqMessage class for messages holding an IIntegrationEvent implementation.
public class RabbitMqEventBus<TMarker> : RabbitMqEventBus, IDisposable, IAsyncDisposable, IAsyncHealthCheckProvider<IConnection>, IPublishSubscribeChannel<IIntegrationEvent, TMarker>, IPublishSubscribeChannel<IIntegrationEvent>, IPublisher<IIntegrationEvent, TMarker>, IPublisher<IIntegrationEvent>, ISubscriber<IIntegrationEvent, TMarker>, ISubscriber<IIntegrationEvent>, IDependencyInjectionMarker<TMarker>
Type Parameters
TMarker
- Inheritance
-
RabbitMqEventBus<TMarker>
- Implements
-
IAsyncHealthCheckProvider<IConnection>IPublishSubscribeChannel<IIntegrationEvent, TMarker>IPublisher<IIntegrationEvent, TMarker>ISubscriber<IIntegrationEvent, TMarker>IDependencyInjectionMarker<TMarker>
- Inherited Members
Examples
The RabbitMqEventBus registered by AddRabbitMqEventBus is the concrete DI-managed event bus; resolve it to access PublishAsync and SubscribeAsync.
using System;
using Microsoft.Extensions.DependencyInjection;
using Savvyio.EventDriven;
using Savvyio.Extensions.RabbitMQ.EventDriven;
using Savvyio.Messaging;
namespace ExampleApp;
public class RabbitMqEventBusUsage
{
private readonly RabbitMqEventBus _bus;
public RabbitMqEventBusUsage(RabbitMqEventBus bus)
{
_bus = bus;
}
public IPublishSubscribeChannel<IIntegrationEvent> AsChannel() => _bus;
}
Constructors
RabbitMqEventBus(IMarshaller, RabbitMqEventBusOptions<TMarker>)
Initializes a new instance of the RabbitMqEventBus class.
public RabbitMqEventBus(IMarshaller marshaller, RabbitMqEventBusOptions<TMarker> options)
Parameters
marshallerIMarshallerThe marshaller used for serializing and deserializing messages.
optionsRabbitMqEventBusOptions<TMarker>The options used to configure the RabbitMQ event bus.
Exceptions
- ArgumentNullException
marshallercannot be null -or-optionscannot be null.- ArgumentException
optionsare not in a valid state.
See Also
IPublishSubscribeChannel<TRequest, TMarker>