Interface IExchange

Assembly: redb.Route.dll

Represents a message exchange in the route pipeline.
Contains In message (always present), optional Out message (lazy),
exchange pattern, route-level properties, and error state.
Supports both C# idiomatic properties and Java-style methods.

public interface IExchange : IAsyncDisposable

Properties

Context

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

IRouteContext? Context { get; }

Exception

Current exception if processing failed.

Exception? Exception { get; set; }

ExceptionHandled

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

bool ExceptionHandled { get; set; }

ExchangeId

Unique identifier of this exchange instance, generated at creation.

string ExchangeId { get; }

HasOut

Whether Out is populated (non-null).

bool HasOut { get; }

In

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

IMessage In { get; set; }

IsStopped

Whether processing of this exchange has been stopped.

bool IsStopped { get; }

Out

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

IMessage? Out { get; set; }

Pattern

Current exchange pattern. Default = InOnly.

ExchangePattern Pattern { get; set; }

Properties

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

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

RouteId

Identifier of the route this exchange belongs to.

string? RouteId { get; set; }

ServiceProvider

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

IServiceProvider? ServiceProvider { get; }

Methods

Clone()

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

IExchange Clone()

CloneLinked()

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

IExchange CloneLinked()

copy()

Java-style: deep copy (alias for Clone).

IExchange copy()

CorrelatedCopy()

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

IExchange CorrelatedCopy()

CorrelatedCopyLinked()

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

IExchange CorrelatedCopyLinked()

CreateChild(IMessage)

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

IExchange CreateChild(IMessage message)

CreateLinkedChild(IMessage)

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

IExchange CreateLinkedChild(IMessage message)

getIn()

Java-style: returns In message.

IMessage getIn()

getOut()

Java-style: returns Out message.

IMessage? getOut()

getProperty(string)

Java-style: returns property value by key.

object? getProperty(string key)

getProperty<T>(string)

Java-style: returns property value cast to T.

T? getProperty<T>(string key)

GetProperty<T>(string)

Gets a property value with type conversion.

T? GetProperty<T>(string key)

isStop()

Java-style: returns true if route processing is stopped.

bool isStop()

ReleaseScopes()

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

ValueTask ReleaseScopes()

RouteStop()

Java-style: stops route processing (alias for Stop).

void RouteStop()

setProperty(string, object?)

Java-style: sets property value.

void setProperty(string key, object? value)

Snapshot()

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

IExchange Snapshot()

Stop()

Stops further processing of this exchange in the pipeline.

void Stop()