Interface IRoutePolicy

Assembly: redb.Route.dll

Controls route lifecycle and receives per-exchange notifications.
Analogous to Apache Camel's RoutePolicy.
All methods have default no-op implementations — override only what you need.

public interface IRoutePolicy

Methods

GetMetadata()

Returns policy-specific metadata for observability (UI, API, diagnostics).

IReadOnlyDictionary<string, object>? GetMetadata()

OnExchangeBegin(IRouteContext, IExchange, CancellationToken)

Called when an exchange starts processing in this route.

Task OnExchangeBegin(IRouteContext context, IExchange exchange, CancellationToken ct)

OnExchangeDone(IRouteContext, IExchange, CancellationToken)

Called when an exchange finishes processing (success or failure).

Task OnExchangeDone(IRouteContext context, IExchange exchange, CancellationToken ct)

OnInit(IRouteContext, CompiledRoute, CancellationToken)

Called once after the route is compiled but before consumers start.

Task OnInit(IRouteContext context, CompiledRoute route, CancellationToken ct)

OnRemove(IRouteContext, CompiledRoute, CancellationToken)

Called when the route is being removed from the context (final cleanup).

Task OnRemove(IRouteContext context, CompiledRoute route, CancellationToken ct)

OnResume(IRouteContext, CompiledRoute, CancellationToken)

Called when the route is being resumed after suspension.

Task OnResume(IRouteContext context, CompiledRoute route, CancellationToken ct)

OnStart(IRouteContext, CompiledRoute, CancellationToken)

Called before the route consumer is started. Throw to prevent startup.

Task OnStart(IRouteContext context, CompiledRoute route, CancellationToken ct)

OnStop(IRouteContext, CompiledRoute, CancellationToken)

Called after the route consumer has been stopped.

Task OnStop(IRouteContext context, CompiledRoute route, CancellationToken ct)

OnSuspend(IRouteContext, CompiledRoute, CancellationToken)

Called when the route is being suspended (drain starting).

Task OnSuspend(IRouteContext context, CompiledRoute route, CancellationToken ct)