Interface IProtoMessageBroker

Namespace
ProtoTest.Messaging
Assembly
ProtoTest.Messaging.dll

The broker capability's state-free adapter contract. The capability owns the broker resource and the trace-facing API; an adapter owns the client technology (RabbitMQ today, others later). One broker is shared by the whole run and may publish concurrently, while every test gets its own IProtoMessageConsumer.

public interface IProtoMessageBroker
Extension Methods

Properties

Name

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

string Name { get; }

Property Value

string

Methods

CreateConsumerAsync(CancellationToken)

Creates a consumer for one test. The caller owns it for that test and disposes it with the test's teardown, so an adapter can declare per-test taps and remove them at the test boundary: parallel tests on the same destination stay isolated instead of stealing each other's messages.

ValueTask<IProtoMessageConsumer> CreateConsumerAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask<IProtoMessageConsumer>

PublishAsync(ProtoMessage, CancellationToken)

Publishes one message to a destination.

ValueTask PublishAsync(ProtoMessage message, CancellationToken cancellationToken = default)

Parameters

message ProtoMessage
cancellationToken CancellationToken

Returns

ValueTask