Class ProtoMessageClient

Namespace
ProtoTest.Messaging
Assembly
ProtoTest.Messaging.dll

The test-side messaging API over the configured broker. Publishes and awaits are traced as messaging.publish and messaging.await operations with the payload as a section, and recorded as observations so coverage can aggregate destinations.

public sealed class ProtoMessageClient
Inheritance
ProtoMessageClient
Inherited Members
Extension Methods

Methods

AwaitAsync(string, Func<ProtoMessage, bool>, TimeSpan?, CancellationToken)

Waits for the first message on destination matching predicate within the timeout (the configured default when none is given). Failing to arrive is a test failure, not a sleep.

public Task<ProtoMessage> AwaitAsync(string destination, Func<ProtoMessage, bool> predicate, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

destination string
predicate Func<ProtoMessage, bool>
timeout TimeSpan?
cancellationToken CancellationToken

Returns

Task<ProtoMessage>

PublishAsync(string, string?, IReadOnlyDictionary<string, string?>?, string?, CancellationToken)

Publishes one message, optionally with headers and a content type.

public Task PublishAsync(string destination, string? payload = null, IReadOnlyDictionary<string, string?>? headers = null, string? contentType = null, CancellationToken cancellationToken = default)

Parameters

destination string
payload string
headers IReadOnlyDictionary<string, string>
contentType string
cancellationToken CancellationToken

Returns

Task