redb.Route capabilities

redb.Route is an integration framework for .NET. A route takes a message from a consumer endpoint, passes it through processing steps and sends it to producer endpoints; every endpoint is a URI. Routes are written in a fluent C# DSL or in XML, and run in any .NET host or in redb.Tsak.

Route model and DSL forms

  • A route goes from a consumer endpoint (From) through processing steps to producer endpoints (To).
  • Endpoints are URIs of the form scheme:path?options, for example kafka://orders?groupId=svc or sql:SELECT ...?dataSource=main.
  • Fluent C# DSL: subclass RouteBuilder and write From(...).Filter(...).To(...) in Configure(); IRouteDefinition carries every verb.
  • Dynamic targets: ToD(...) resolves the endpoint URI per message.
  • XML routes: .route.xml documents (namespace urn:redb:route:1.0) load into the same fluent DSL, one element per DSL verb; package redb.Route.Xml.
  • XML covers EIP blocks (transaction, split, aggregate, saga, scatterGather, loadBalance and others), beans, route configurations and the REST DSL (<rest>).
  • XML limit: no lambdas or inline code; XML references code by name (bean:#name, predicate="#name", processor="#name").
  • XML limit: a ${...} placeholder is refused in a consumer URI (<from>).
  • Developer tool redb-route-xml (package redb.Route.Xml.CodeGen): new, check, pack (a .tpkg package), catalog, xsd, csharp (XML to fluent C#), mermaid (flowchart).
  • The check and pack gate validates the schema, undeclared #references, bean types, and every endpoint option against the connector's real options (with --bin).
  • Configuration placeholders {{key}} and {{key:default}} in URIs and attributes.
  • Engine options bind from the RedbRoute configuration section (RouteEngineOptions).
  • Route options: RouteId, Description, AutoStart, ProcessingTimeout, RoutePolicy, RouteConfigurationId.
  • Route configurations: OnException handlers declared apart from the routes and shared by several of them.
  • Interceptors: Intercept(), InterceptFrom(pattern), InterceptSendToEndpoint(pattern); OnCompletion() blocks.
  • Bean references: Bean<TService>(), the bean: endpoint, bean:name.Method(args) in expressions, Method("#name", ...).
  • Calling routes from code: ProducerTemplate and ConsumerTemplate.

Exchange and message model

  • IExchange: In and Out messages, Properties, Exception, ExchangeId, RouteId, Pattern, Stop().
  • ExchangePattern: InOnly, InOut (request-reply), OutOnly.
  • IMessage: Body, Headers, ContentType, Attachments.
  • Attachments: AddAttachment, AddAttachmentFromBody, AddAttachmentFromFile, RemoveAttachment(s); carried by smtp:, MIME multipart and AS4.
  • Large bodies: StreamCaching() and engine-wide stream cache options; StreamBody options on file, S3, AS2, AS4 and Firebase Storage.
  • Camel-style accessors on the exchange and the message (getIn(), getBody<T>(), setHeader(...)) next to the .NET properties.
  • Header filtering per endpoint: IHeaderFilterStrategy (option headerFilterStrategy).
  • Expression language: compiled templates and conditions, for example Filter("header.amount > 1000 AND header.region == 'eu'"), Expr("${header.id}").
  • Expression helpers: Body(), Header(), Property(), Constant(), JPath(...), XPath(...).
  • Predicates: isEqualTo, isGreaterThan, isBetween, contains, regex, In, isNull and more.
  • XPath 2.0 expressions: package redb.Route.XPath2.
  • Custom expression roots: context.RegisterPrefixResolver("order.", ...).

Integration patterns (DSL verb names)

  • Routing: Choice/When/Otherwise, Filter, RecipientList, DynamicRouter, RoutingSlip, LoadBalance (RoundRobin, Random, Weighted, Sticky, Failover).
  • Splitting and joining: Split, Aggregate, Multicast, ScatterGather, Resequence.
  • Enrichment: Enrich, PollEnrich, ClaimCheck, Normalize.
  • Flow control: Throttle, Delay, Sample, Debounce, Loop / LoopWhile, CircuitBreaker, Threads (asynchronous continuation).
  • Monitoring: WireTap, Log, MessageHistory, Traced, Metered, SpanTag.
  • Transformation: SetBody, Transform, SetHeader(s), SetProperty(ies), Remove*, ConvertBody<T>, Sort, OfType<T>.
  • Validation: Validate(...), ValidateJsonSchema(...), ValidateXsd(...), the validator: endpoint; FluentValidation and DataAnnotations through redb.Route.Validation.Adapters.
  • XSLT: Xslt(...) and the xslt: endpoint.
  • Saga: Saga() with SagaStep compensations and OnSagaCompletion.
  • Idempotent Consumer: IdempotentConsumer(repository, key).
  • Cache as a step: package redb.Route.Cache (IMemoryCache or IDistributedCache), the cache: endpoint and <cache> in XML.
  • JSON-to-JSON transformation with JSONata: package redb.Route.JsonTransform (<transformJson>).
  • Payload templates with Scriban: package redb.Route.Templates (<payload>); sandboxed, with no include and no method calls.
  • Control Bus: ControlBus(...) and the controlbus: endpoint, route actions Start, Stop, Suspend (same as Stop), Resume, Restart, Status, Stats, Fail.
  • controlbus:notify delivers route, context and connection events.

Error handling and redelivery

  • OnException<T>() per route, per RouteBuilder or per route configuration; the nearest exception type wins, as in Apache Camel.
  • Redelivery inside OnException: MaximumRedeliveries, RedeliveryDelay, BackOffMultiplier, UseExponentialBackOff, RetryWhile, OnRedelivery, RedeliveryPolicy.
  • Handled() ends the route where it failed; Continued() resumes at the next step.
  • UseOriginalMessage(), UseOriginalBody(), OnPrepareFailure, OnExceptionOccurred, LogExhausted, RetryAttemptedLogLevel.
  • Scoped handling: DoTry / DoCatch<T> / DoFinally (TryCatch).
  • Dead letter channel for the context: context.ErrorHandler = new DeadLetterErrorHandler(context, uri); in XML <deadLetterChannel uri=...>.
  • Dead-lettered exchanges carry the headers CamelDeadLetterReason, CamelDeadLetterExceptionType, CamelDeadLetterTimestamp and CamelDeadLetterRedeliveryCount.
  • Context-level handlers: AddGlobalExceptionHandler, AddLocalExceptionHandler.
  • Per-step retry inside a transaction: Transacted().Retry(attempts, delay).
  • Explicit steps: ThrowException, Stop, and RollbackAll, which rolls back without an exception so the broker redelivers (the behaviour of Camel's markRollbackOnly).

Transactions

  • Transacted() / Transaction() wraps steps in a System.Transactions scope.
  • TransactionPolicy: Default, RequiresNew, Suppress, Mandatory, isolation level and timeout.
  • In XML: the <transaction> block.
  • Deferred acknowledgement (ITransactedAction): the broker message is acknowledged or committed only after the route succeeds, on AMQP, IBM MQ, Kafka, Azure Service Bus and SQS.
  • RabbitMQ acknowledges after the route by default, with ackMode=manual.
  • ackMode=auto acknowledges on receipt instead (at-most-once) and cannot be combined with Transacted().
  • Kafka transactions with exactly-once consume-process-produce: transactionalIdPrefix.
  • sql: steps enlist in the ambient System.Transactions scope of a Transacted() block.
  • dataSource=redb (or redb:<name>): a sql: step runs on the connection of the exchange's redb service, so it commits or rolls back with the redb steps in one transaction, without a distributed transaction (package redb.Route.Core).
  • dataSource=redb limits: no StreamList output, no breakBatchOnError=false batches, not on the polling sql: consumer and not in the SQL repositories.
  • redb steps (RedbSave, RedbGet, RedbQuery, RedbDelete, ProcessWithRedb) enlist in the route's transaction (package redb.Route.Core).

Idempotency and claim check

  • IIdempotentRepository implementations: InMemoryIdempotentRepository, SqlIdempotentRepository (redb.Route.Sql), RedbIdempotentRepository (redb.Route.Core).
  • A failed or rolled-back exchange gives its idempotency key back, so the message is processed again on redelivery.
  • Connector-level idempotency on the file, FTP, SFTP, S3, Firebase Storage, mail and AS4 consumers (options idempotent and idempotentRepository).
  • IClaimCheckRepository implementations: InMemoryClaimCheckRepository, FileClaimCheckRepository, SqlClaimCheckRepository, RedisClaimCheckRepository.

Scheduling

  • timer: endpoint (core): period, delay, repeat count.
  • cron: and qtimer: endpoints on Quartz.NET (redb.Route.Quartz): cron schedules, time zones, calendars, misfire policy, start and end times.
  • Persistent or clustered Quartz job store through QuartzSchedulerOptions.
  • A job paused on the scheduler stays paused across route restarts.
  • exec: and llm: consumers run on a schedule.
  • Polling consumers (file, FTP, SFTP, S3, sql, mail, Elasticsearch) take delay and initialDelay.

Connectors and components

Each line: scheme, side (consumer, producer or both), NuGet package, what it does.

Core package redb.Route:

  • direct (both), redb.Route: synchronous call of another route in the same context.
  • direct-vm, vm (both), redb.Route: synchronous or queued call of a route in another context of the same process.
  • seda (both), redb.Route: in-memory queue with concurrent consumers.
  • timer (consumer), redb.Route: fixed-interval trigger.
  • log (producer), redb.Route: logs the exchange.
  • mock (both), redb.Route: test endpoint with expectations.
  • bean (producer), redb.Route: calls a method of a registered object.
  • controlbus (both), redb.Route: route management and lifecycle events.
  • validator (producer), redb.Route: validates the body.
  • xslt (producer), redb.Route: XSLT transformation.

Connector packages:

  • amqp (both), redb.Route.Amqp: AMQP 1.0 (ActiveMQ Artemis and Classic, Azure Service Bus, Amazon MQ, Qpid).
  • as2, as2s (both), redb.Route.As2: AS2 (RFC 4130) signed and encrypted S/MIME messages with MDN receipts.
  • as4, as4s (both), redb.Route.As4: AS4 / ebMS 3.0 following the eDelivery AS4 common profile; signing, encryption, receipts.
  • asb (both), redb.Route.AzureServiceBus: Azure Service Bus queues, topics, sessions, PeekLock and ReceiveAndDelete.
  • cache (producer), redb.Route.Cache: cache get and put as an endpoint.
  • elasticsearch, es (both), redb.Route.Elasticsearch: index, get, search, bulk and other operations; polling consumer with delete-after-read.
  • exec (both), redb.Route.Exec: runs a process with an allowlist, working directory, environment, timeout and output caps.
  • file (both), redb.Route.File: polling consumer with glob filters and read locks; atomic producer that refuses to write outside its directory.
  • ftp (both), redb.Route.Ftp: FTP and FTPS on FluentFTP, polling consumer and atomic producer.
  • sftp (both), redb.Route.Sftp: SFTP on SSH.NET, key or password authentication.
  • fstore (both), redb.Route.Firebase: Firestore CRUD, queries, batch writes; realtime snapshot listener as consumer.
  • fbstorage (both), redb.Route.Firebase: Firebase Cloud Storage upload, download, delete, copy, list, metadata.
  • fcm (producer), redb.Route.Firebase: Firebase Cloud Messaging push; messages are received on devices, not by a route.
  • grpc (both), redb.Route.Grpc: gRPC methods as routes on the shared Kestrel host; the producer calls any method.
  • http (both), redb.Route.Http: HttpClient producer; Kestrel consumer (webhooks) with CORS, authentication and streaming; REST DSL with an OpenAPI document.
  • wmq (both), redb.Route.IbmMq: IBM MQ queues and topics, transactions, request-reply, message groups, TLS; poll or listener receive. Limit: a request with a reply-to cannot be answered from a one-way batch.
  • kafka (both), redb.Route.Kafka: consumer groups, deferred commit, idempotent producer, transactions.
  • ldap (both), redb.Route.Ldap: LDAP and Active Directory search, CRUD, authentication, change tracking.
  • llm (both), redb.Route.Llm: an LLM call as a route step or as a scheduled agent, with tools (Anthropic and OpenAI providers).
  • embed, stt, knowledge (producers), redb.Route.Llm: embeddings, transcription and retrieval ingest.
  • mcp (producer), redb.Route.Llm.Mcp: calls tools of external MCP servers (stdio, HTTP+SSE) from the LLM agent.
  • imap, pop3 (consumer) and smtp (producer), redb.Route.Mail: mail on MailKit, IMAP IDLE, attachments, TLS, OAuth. Limit: POP3 keeps no read flags, so use idempotent.
  • mqtt (both), redb.Route.MqttNet: MQTT 5.0 on MQTTnet, shared subscriptions, QoS, retained messages, TLS.
  • rabbitmq (both), redb.Route.RabbitMQ: RabbitMQ.Client 7.x, exchanges, queues, dead-letter, priority, TTL, publisher confirms.
  • redis (both), redb.Route.Redis: Pub/Sub, Streams, keys, lists and sorted sets on StackExchange.Redis.
  • s3 (both), redb.Route.S3: S3 and MinIO, polling consumer, multipart upload, server-side encryption, presigned URLs.
  • signalr (both), redb.Route.SignalR: embedded SignalR hub as consumer; client or server-broadcast producer; a Redis backplane package, redb.Route.SignalR.StackExchangeRedis. Limit: a backplane does not restore group membership.
  • soap, soaps (both), redb.Route.Soap: SOAP 1.1 and 1.2 client and service, WSDL, faults, WS-Security (UsernameToken, XML Signature, XML Encryption), MTOM. Limit: without a WSDL the service does not answer GET.
  • sql (both), redb.Route.Sql: ADO.NET polling consumer, statements, batches, stored procedures; PostgreSQL, SQL Server, SQLite, MySQL, MariaDB, Oracle, Firebird.
  • sqs (both) and sns (producer), redb.Route.Sqs: Amazon SQS queues and SNS topics on AWS SDK v4; an SNS topic is consumed through a subscribed SQS queue. Limit: extendMessageVisibility is refused with batching.
  • tcp (both), redb.Route.Tcp: client and server sockets, text-line, length-prefixed or raw framing, TLS, request-reply. Limit: the server consumer does not request client certificates.
  • telegram (both), redb.Route.Telegram: Telegram bot, long polling or webhook, messages, documents, photos.
  • ws (both), redb.Route.WebSocket: WebSocket client producer and Kestrel server consumer, text and binary frames, reconnect. Limit: maxConnections queues extra clients, it does not refuse them.

Controllers (package redb.Route.Controllers): RedbController classes with attribute routing behind HTTP, SOAP, SignalR and gRPC endpoints.

Data formats and converters

  • Marshal / Unmarshal with registered formats (IDataFormatRegistry); JSON (JsonMessageSerializer) and XML (XmlMessageSerializer) are built in.
  • Built-in wrappers: Base64MessageSerializer, GZipMessageSerializer, ZipMessageSerializer; form-urlencoded (FormUrlEncodedMessageSerializer).
  • CSV: MarshalCsv / UnmarshalCsv (redb.Route.DataFormats.Csv, CsvHelper).
  • YAML: MarshalYaml / UnmarshalYaml (redb.Route.DataFormats.Yaml, YamlDotNet).
  • Avro: MarshalAvro / UnmarshalAvro (redb.Route.DataFormats.Avro); schema registry not included.
  • Protobuf: MarshalProtobuf / UnmarshalProtobuf (redb.Route.DataFormats.Protobuf); schema registry not included.
  • MIME multipart and multipart/form-data: MarshalMimeMultipart / UnmarshalMimeMultipart; parts become attachments.
  • XML to JSON and back without a class: MarshalXmlJson / UnmarshalXmlJson (redb.Route.DataFormats.XmlJson); documents with a DTD are refused.
  • Type conversion of the body: ConvertBody<T>(), Unmarshal<T>().

Management, health and metrics

  • OpenTelemetry: ActivitySource and Meter named "redb.Route"; spans for every transport, step metrics, Traced/Metered/SpanTag in the DSL.
  • Health check: RouteHealthCheck, registered with AddRedbRouteCheck(); reports routes, failed consumers and lost connections.
  • Connection supervision: reconnect with back-off (RouteEngineOptions.Reconnect); events ConnectionLost, ReconnectFailed, ConnectionRestored.
  • A consumer that fails to start marks its route Errored and can retry in the background (ConsumerStartRetry).
  • In-flight exchanges: IInflightRepository; graceful drain on stop with ShutdownTimeout.
  • Per-route and per-endpoint statistics.
  • Processing timeouts with an ExchangeTimedOut event.
  • Thread pool profiles for asynchronous steps (DefaultThreadPoolProfile, ThreadPoolProfiles).
  • Secrets: connectionFactory=<name> keeps credentials out of URIs.
  • Sensitive options are masked in logs, spans, metrics and health output.

Hosting

  • Generic host: services.AddRedbRoute(...) registers the engine; RouteHostedService starts and stops the route context.
  • Plain code: new RouteContext(), AddRoutes(...), Start().
  • One Kestrel per host and port, shared by the HTTP, AS2, AS4, gRPC, SignalR, SOAP and WebSocket consumers (redb.Route.Http.Hosting, SharedHttpServerManager), with TLS, trusted proxies and concurrency limits.
  • redb.Tsak: a host that loads .tpkg route packages (built with redb-route-xml pack), with hot reload, a web dashboard and cluster-aware routes (Cluster()).
  • redb.Route.Core: typed access to redb storage from routes (GetRedbService, ProcessWithRedb, RedbQuery with conditions over props and base fields).

Testing

  • redb.Route.TestKit: AdviceWith (weave or replace steps, swap endpoints for mocks), NotifyBuilder, MockUri; works with xUnit, NUnit and MSTest.
  • mock: endpoints with expectations (MockAssertionException).

VS Code extension (redb Route XML)

  • Command "redb: New Project" creates projects from the redb template packages through dotnet new.
  • Completion and validation for every XML element and every connector option, with the consumer and producer sides checked.
  • Route tree, skeletons for route, choice and tryCatch, bean reference hints.
  • Route graph editor over the XML text (insert, delete and move steps) and a Mermaid diagram.

Templates

  • dotnet new templates for XML route modules in package redb.Templates: redb-route, redb-route-eip, redb-route-beans, redb-route-rest, redb-route-sql, redb-route-sql-batch, redb-route-kafka, redb-route-rabbitmq, redb-route-amqp, redb-route-mqtt, redb-route-file, redb-route-s3, redb-route-email, redb-route-ldap, redb-route-cron, redb-route-as2, redb-route-as4, redb-route-scatter-gather, redb-route-validator-xslt, redb-route-xmljson, redb-route-redb.
  • Tsak host templates in package redb.Tsak.Templates.

Supported .NET

  • .NET 10 and .NET 11 (net10.0, net11.0).

Sources and documentation: github.com/redbase-app/redb-route, redbase.app.