Class ProtoHostBuilderExtensions

Namespace
ProtoTest.Messaging
Assembly
ProtoTest.Messaging.dll
public static class ProtoHostBuilderExtensions
Inheritance
ProtoHostBuilderExtensions
Inherited Members

Methods

AddMessaging(IProtoHostBuilder, Action<ProtoMessagingBuilder>?)

Adds the messaging capability: publish and await messages over a broker. Without an adapter the run uses the in-memory broker, so the API works anywhere; a real adapter replaces it, registers the Broker capability and is released with the run as an owned resource. An adapter that declares its address keys (see UseBroker(Func<IServiceProvider, IProtoMessageBroker>, params string[])) declares the capability conditionally: it is absent while no key can provide the address, so [RequiresCapability(ProtoCapabilityKinds.Broker)] skips instead of failing. An adapter that serves only behind the in-process test host (see UseBrokerWhenInProcess(Func<IServiceProvider, IProtoMessageBroker>, string, params string[])) declares it the other way: the application's provider chain winner decides, and a host without a chain keeps the configured-keys rule.

public static IProtoHostBuilder AddMessaging(this IProtoHostBuilder builder, Action<ProtoMessagingBuilder>? configure = null)

Parameters

builder IProtoHostBuilder
configure Action<ProtoMessagingBuilder>

Returns

IProtoHostBuilder

Remarks

A repeated call is not a no-op: its configure callback always runs, so a later call can add an adapter to an adapter-less first call or extend attachment options. Infrastructure is idempotent (one holder, initializer, capability and run resource) and the first adapter wins; a call whose configure throws leaves no guard behind, so a later successful call still composes.