Interface IConsumerTemplate

Assembly: redb.Route.dll

Template for polling messages from endpoints programmatically,
without creating a full route. Mirrors Apache Camel's ConsumerTemplate.

Use for blocking poll,
for timed poll,
and for non-blocking poll.

public interface IConsumerTemplate

Properties

Context

Gets the route context associated with this template.

IRouteContext Context { get; }

IsStarted

Gets whether this template has been started and is ready for use.

bool IsStarted { get; }

Methods

DoneUoW(IExchange)

Completes the unit of work of an exchange handed out by a Receive call, Camel's

Task DoneUoW(IExchange exchange)

Receive(IEndpoint, CancellationToken)

Receives an exchange from the specified endpoint, blocking until one is available.

Task<IExchange> Receive(IEndpoint endpoint, CancellationToken ct = default)

Receive(IEndpoint, TimeSpan, CancellationToken)

Receives an exchange from the specified endpoint, waiting up to the given timeout.

Task<IExchange?> Receive(IEndpoint endpoint, TimeSpan timeout, CancellationToken ct = default)

Receive(string, CancellationToken)

Receives an exchange from the specified endpoint URI, blocking until one is available.

Task<IExchange> Receive(string endpointUri, CancellationToken ct = default)

Receive(string, TimeSpan, CancellationToken)

Receives an exchange from the specified endpoint URI, waiting up to the given timeout.

Task<IExchange?> Receive(string endpointUri, TimeSpan timeout, CancellationToken ct = default)

ReceiveBody(string, CancellationToken)

Receives the message body from the specified endpoint URI, blocking until available.

Task<object?> ReceiveBody(string endpointUri, CancellationToken ct = default)

ReceiveBody<T>(string, CancellationToken)

Receives the message body from the specified endpoint URI, blocking until available,

Task<T?> ReceiveBody<T>(string endpointUri, CancellationToken ct = default)

ReceiveBody<T>(string, TimeSpan, CancellationToken)

Receives the message body with a timeout. Returns default if timed out.

Task<T?> ReceiveBody<T>(string endpointUri, TimeSpan timeout, CancellationToken ct = default)

ReceiveNoWait(IEndpoint, CancellationToken)

Attempts to receive an exchange without waiting.

Task<IExchange?> ReceiveNoWait(IEndpoint endpoint, CancellationToken ct = default)

ReceiveNoWait(string, CancellationToken)

Attempts to receive an exchange without waiting.

Task<IExchange?> ReceiveNoWait(string endpointUri, CancellationToken ct = default)

Start()

Starts the consumer template. Must be called before any receive methods.

void Start()

Stop()

Stops the consumer template and its cached consumers. Exchanges received but not completed

void Stop()