Class RabbitMqMessageBroker

Namespace
ProtoTest.Messaging.RabbitMq
Assembly
ProtoTest.Messaging.RabbitMq.dll

The RabbitMQ adapter. Publishing sends to the exchange named like the destination, so the app's topology decides routing. Each test owns a consumer with its own channel and per-test tap queues, deleted when the test ends, so parallel tests may share a destination without stealing each other's messages. The connection is shared by the run and is thread-safe; channels are not, so each side serializes its own.

public sealed class RabbitMqMessageBroker : IProtoMessageBroker, IDisposable
Inheritance
RabbitMqMessageBroker
Implements
Inherited Members
Extension Methods

Constructors

RabbitMqMessageBroker(RabbitMqOptions)

public RabbitMqMessageBroker(RabbitMqOptions options)

Parameters

options RabbitMqOptions

Properties

Name

The adapter name recorded on the capability and the broker entity.

public string Name { get; }

Property Value

string

Methods

CreateConsumerAsync(CancellationToken)

Creates a consumer that owns its own channel on the shared connection.

public ValueTask<IProtoMessageConsumer> CreateConsumerAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask<IProtoMessageConsumer>

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

PublishAsync(ProtoMessage, CancellationToken)

Publishes one message to a destination.

public ValueTask PublishAsync(ProtoMessage message, CancellationToken cancellationToken = default)

Parameters

message ProtoMessage
cancellationToken CancellationToken

Returns

ValueTask