Table of Contents

Class RabbitMqEventBus

Namespace
Savvyio.Extensions.RabbitMQ.EventDriven
Assembly
Savvyio.Extensions.RabbitMQ.dll

Provides a default implementation of the RabbitMqMessage class for messages holding an IIntegrationEvent implementation.

public class RabbitMqEventBus : RabbitMqMessage, IDisposable, IAsyncDisposable, IAsyncHealthCheckProvider<IConnection>, IPublishSubscribeChannel<IIntegrationEvent>, IPublisher<IIntegrationEvent>, ISubscriber<IIntegrationEvent>
Inheritance
RabbitMqEventBus
Implements
Derived
Inherited Members

Constructors

RabbitMqEventBus(IMarshaller, RabbitMqEventBusOptions)

Initializes a new instance of the RabbitMqEventBus class.

public RabbitMqEventBus(IMarshaller marshaller, RabbitMqEventBusOptions options)

Parameters

marshaller IMarshaller

The marshaller used for serializing and deserializing messages.

options RabbitMqEventBusOptions

The options used to configure the RabbitMQ event bus.

Exceptions

ArgumentNullException

marshaller cannot be null -or- options cannot be null.

ArgumentException

options are not in a valid state.

Methods

PublishAsync(IMessage<IIntegrationEvent>, Action<AsyncOptions>)

Publishes the specified integration event message asynchronously to the configured RabbitMQ exchange.

public Task PublishAsync(IMessage<IIntegrationEvent> message, Action<AsyncOptions> setup = null)

Parameters

message IMessage<IIntegrationEvent>

The message to publish.

setup Action<AsyncOptions>

The AsyncOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

SubscribeAsync(Func<IMessage<IIntegrationEvent>, CancellationToken, Task>, Action<SubscribeAsyncOptions>)

Subscribes to integration event messages from the configured RabbitMQ exchange and invokes the specified asynchronous handler for each received message.

public Task SubscribeAsync(Func<IMessage<IIntegrationEvent>, CancellationToken, Task> asyncHandler, Action<SubscribeAsyncOptions> setup = null)

Parameters

asyncHandler Func<IMessage<IIntegrationEvent>, CancellationToken, Task>

The function delegate that will handle the message.

setup Action<SubscribeAsyncOptions>

The SubscribeAsyncOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

See Also