Path: redb-route/redb.Route/Abstractions/IMessageDataFormat.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/IMessageDataFormat.cs
----
namespace redb.Route.Abstractions;
///
/// A data format that works on the whole exchange rather than on bytes alone, as Apache Camel's DataFormat
/// receives the exchange: it reads the content type of the In message with its parameters (a boundary, a
/// charset), reads the body as it came (byte[], string or a , without buffering
/// by the step), writes the body, the content type and the attachments, and takes engine settings from
/// (the stream cache a large part spools to). Marshal, Unmarshal and
/// ConvertBody call these methods when the resolved format implements this interface, and the byte methods of
/// otherwise.
///
///
/// Registration, lookup by content type and the XML dataFormat element are those of
/// . A format sets and the Content-Type header
/// itself; the step does not overwrite them. A format decides itself what to do with a body that is not its own (MIME
/// multipart leaves it unchanged, as Camel's mimeMultipart does).
///
public interface IMessageDataFormat : IMessageSerializer
{
/// Turns the wire form in exchange.In into , in place.
ValueTask UnmarshalAsync(IExchange exchange, Type targetType, CancellationToken ct = default);
/// Turns the body of exchange.In (and its attachments, when the format carries them) into the wire form, in place.
ValueTask MarshalAsync(IExchange exchange, CancellationToken ct = default);
}