Class Exchange

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

Default implementation of IExchange.
In is always present, Out is lazy (null by default for InOnly routes).

public class Exchange : IExchange, IAsyncDisposable

Inheritance

Object→Exchange

Implements

Properties

Context

The route context currently processing this exchange (Apache Camel's

public IRouteContext? Context { get; }

Exception

Current exception if processing failed.

public Exception? Exception { get; set; }

ExceptionHandled

Whether the current exception has been handled by error handling logic.

public bool ExceptionHandled { get; set; }

ExchangeId

Unique identifier of this exchange instance, generated at creation.

public string ExchangeId { get; }

HasOut

Whether Out is populated (non-null).

public bool HasOut { get; }

In

Primary message flowing through the pipeline. Always non-null.

public IMessage In { get; set; }

IsStopped

Whether processing of this exchange has been stopped.

public bool IsStopped { get; }

Out

Response message from request-reply or explicit .Respond().

public IMessage? Out { get; set; }

Pattern

Current exchange pattern. Default = InOnly.

public ExchangePattern Pattern { get; set; }

Properties

Route-level metadata (RouteId, TRANSACT_ACTION, etc.).

public IDictionary<string, object?> Properties { get; }

RouteId

Identifier of the route this exchange belongs to.

public string? RouteId { get; set; }

ServiceProvider

Optional scoped service provider bound to this exchange's lifetime.

public IServiceProvider? ServiceProvider { get; }

Methods

Clone()

Structural copy of the exchange (In, Out, Properties containers + a fresh DI scope). The

public IExchange Clone()

CloneLinked()

Creates a deep copy of the exchange that shares the parent's DI scope (no new scope).

public IExchange CloneLinked()

CorrelatedCopy()

A copy that goes on as an exchange of its own, as Apache Camel's ExchangeHelper.createCorrelatedCopy

public IExchange CorrelatedCopy()

CorrelatedCopyLinked()

sharing this exchange's DI scope, as : for a copy processed

public IExchange CorrelatedCopyLinked()

Create(IMessage, IServiceScopeFactory?)

Creates an exchange, optionally with a per-exchange DI scope.

public static Exchange Create(IMessage message, IServiceScopeFactory? scopeFactory)

CreateChild(IMessage)

Creates a child exchange with the given message, inheriting Properties, RouteId,

public IExchange CreateChild(IMessage message)

CreateLinkedChild(IMessage)

Creates a child exchange that shares the parent's DI scope (no new scope).

public IExchange CreateLinkedChild(IMessage message)

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or

public ValueTask DisposeAsync()

GetProperty<T>(string)

Gets a property value with type conversion.

public T? GetProperty<T>(string key)

ReleaseScopes()

Releases DI scopes (main scope + named __redb_scope:* entries) and the resources registered with

public ValueTask ReleaseScopes()

Snapshot()

Deep, isolated snapshot for checkpoint/replay. Unlike it deep-copies

public IExchange Snapshot()

Stop()

Stops further processing of this exchange in the pipeline.

public void Stop()

Constructors

Exchange()

Creates an exchange with a new empty In message.

Exchange(IMessage, IServiceScopeFactory)

Creates an exchange with DI scope support.

Exchange(IMessage)

Creates an exchange with the specified In message.