Class ConnectableProducer
Base class for connection-based producers.
Handles: started guard, logger resolution, Start/Stop lifecycle.
Subclasses implement and optionally override .
public abstract class ConnectableProducer : IProducer, IProcessor
Inheritance
Implements
Derived
Properties
ProducerEndpoint
The endpoint this producer sends to.
protected abstract IEndpoint ProducerEndpoint { get; }
ProducerName
Display name for logging (e.g. "http:https://api.example.com", "kafka:orders").
protected abstract string ProducerName { get; }
Supervisor
The supervisor of this producer's connection, created on first use with the context's reconnect options
protected ConnectionSupervisor Supervisor { get; }
Methods
ConnectAsync(CancellationToken)
Set up connection/resources. Awaited by Start() to completion before IsStarted flips to
protected abstract Task ConnectAsync(CancellationToken ct)
DisconnectAsync(CancellationToken)
Tear down connection/resources. Called from Stop() after the started flag is cleared.
protected virtual Task DisconnectAsync(CancellationToken ct)
EnsureConnectedAsync(CancellationToken)
Called by before it sends: when the connection was marked lost, either fails at once while
protected Task EnsureConnectedAsync(CancellationToken ct)
MarkConnectionLost(Exception)
Reports that the connection is lost: from a send, a reply loop, a transacted action's commit or a client callback.
protected void MarkConnectionLost(Exception cause)
OnConnectionLost(Exception)
Fails what waits on the lost connection, such as pending request-reply calls. Default: nothing.
protected virtual void OnConnectionLost(Exception cause)
Process(IExchange, CancellationToken)
Processes the exchange asynchronously.
public abstract Task Process(IExchange exchange, CancellationToken ct = default)