Class ConsumerTemplate

Namespace: redb.Route.Core
Assembly: redb.Route.dll

Template for polling messages from endpoints programmatically, as Apache Camel's.
SEDA endpoints are read straight from their queue. Any other endpoint gets one consumer per
endpoint, started on first use and kept until : every exchange it produces waits
in a queue for a Receive, and its source does not commit it (delete or move the file,
acknowledge the message) until the caller completes it with . Exchanges no
Receive took stay uncommitted in their source.

public class ConsumerTemplate : IConsumerTemplate, IDisposable

Inheritance

Object→ConsumerTemplate

Implements

Properties

Context

Gets the route context associated with this template.

public IRouteContext Context { get; }

IsStarted

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

public bool IsStarted { get; }

Methods

Dispose()

Disposes the consumer template, stopping its consumers.

public void Dispose()

DoneUoW(IExchange)

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

public Task DoneUoW(IExchange exchange)

Receive(IEndpoint, CancellationToken)

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

public 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.

public 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.

public 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.

public 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.

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

ReceiveBody<T>(string, CancellationToken)

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

public 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.

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

ReceiveNoWait(IEndpoint, CancellationToken)

Attempts to receive an exchange without waiting.

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

ReceiveNoWait(string, CancellationToken)

Attempts to receive an exchange without waiting.

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

Start()

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

public void Start()

Stop()

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

public void Stop()

Constructors

ConsumerTemplate(IRouteContext)

Initializes a new instance with the specified route context.