Path: redb-route/redb.Route/Abstractions/IExchangeCompletion.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route/Abstractions/IExchangeCompletion.cs
----
namespace redb.Route.Abstractions;
///
/// Work attached to the outcome of an exchange's unit of work (Apache Camel: a Synchronization passed to
/// addOnCompletion). Register it with ; exactly one of the two
/// methods runs, once, when the unit of work ends.
///
/// A failing completion is logged and does not change the exchange's outcome or stop the other completions. Both methods
/// receive : the outcome has to be recorded even for an exchange that was cancelled.
///
///
public interface IExchangeCompletion
{
/// The unit of work succeeded: the consumer acknowledges the message.
Task OnComplete(IExchange exchange, CancellationToken ct);
///
/// The unit of work did not succeed: an exception escaped the route, a failure was left unhandled on the exchange,
/// or the route marked it rollback-only (.RollbackAll()). The consumer does not acknowledge the message.
///
Task OnFailure(IExchange exchange, CancellationToken ct);
}