Class ExchangeResources

Assembly: redb.Route.dll

Resources an exchange releases when it ends (Apache Camel: exchange.getExchangeExtension().addOnCompletion(...)).
A component that hands the route something still holding a connection — a streamed query result, say — registers it
here, so the connection is returned when the exchange is released: whether or not the route used it, and whatever became
of the body or header that carried it.

Registered resources live in the exchange's properties under . The exchange releases them in
ReleaseScopes (and so in DisposeAsync), most recent first and before its DI scopes; a failing release is
logged and does not stop the others. Copies of the exchange — child, linked child, clone, snapshot — do not inherit them:
a resource belongs to the exchange that registered it.


Work that depends on how the exchange ended — confirm on success, undo on failure — registers an
with instead: it runs when the exchange's unit of work
ends, which for a consumed message is before the consumer acknowledges it or hands it back to the broker.

public static class ExchangeResources

Inheritance

Object→ExchangeResources

Methods

HandOver(IExchange, IExchange)

Moves every resource registered on from to to, so it is released when

public static void HandOver(IExchange from, IExchange to)

OnCompletion(IExchange, IExchangeCompletion)

Registers completion to run when the unit of work of exchange ends (Apache

public static void OnCompletion(IExchange exchange, IExchangeCompletion completion)

ReleaseWithExchange(IExchange, IAsyncDisposable)

Registers resource to be released when exchange ends.

public static void ReleaseWithExchange(IExchange exchange, IAsyncDisposable resource)