Path: redb-route/tests/redb.Route.Tests.Xml/Examples/Generated/DeepDslShowcaseRoutes.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/tests/redb.Route.Tests.Xml/Examples/Generated/DeepDslShowcaseRoutes.cs ---- // /deep-dsl-showcase.route.xml — do not edit; regenerate instead. /> #nullable enable using System; using System.Collections.Generic; using Microsoft.Extensions.Logging; using redb.Route.Abstractions; using redb.Route.Aggregation; using redb.Route.ControlBus; using redb.Route.Core; using redb.Route.Transactions; using redb.Route.Xml; using redb.Route.Xslt; namespace redb.Route.Tests.Xml.Examples.Generated; /// A generated route builder — see the header for the source file. public sealed class DeepDslShowcaseRoutes : RouteBuilder { protected override void Configure() { Context!.AddToRegistry("isStringList", XmlBeans.Create(Context!, "Acme.Demo.Predicates.IsStringList, Acme.Demo", [], [])); Context!.AddToRegistry("isNonEmptyString", XmlBeans.Create(Context!, "Acme.Demo.Predicates.IsNonEmptyString, Acme.Demo", [], [])); // Branching by body type with a rich log var route0 = From("direct://demo-choice-richlog"); route0.RouteId("demo-choice-richlog"); route0.Description("Branching by body type with a rich log"); route0.SetHeader("step", "start"); var s1 = route0.Choice(); var b2 = s1.When(Context!.GetFromRegistry("isStringList")!); b2.Description("The body is a collection of strings"); b2.SetHeader("branch", "list"); var s3 = b2.Log(LogLevel.Information); s3.ShowRouteId(); s3.Message("opening list branch"); s3.Header("branch"); s3.Property("trace"); s3.EndLog(); var s4 = b2.Split(Expr("body")); s4.SetBody(Expr("${upper(body)}")); s4.Log("[tmpl] item=${body} branch=${header.branch} [${routeId}]"); var s5 = s4.Log(LogLevel.Information); s5.ShowRouteId(); s5.Message("[rich-tmpl] item=${body}"); s5.Header("branch"); s5.Property("item-index"); s5.EndLog(); s4.EndSplit(); b2.Log("list branch done [${routeId}]"); var b6 = s1.When(Context!.GetFromRegistry("isNonEmptyString")!); b6.Description("The body is a non-empty string"); b6.SetHeader("branch", "string"); b6.SetBody(Expr("STR:${body}")); var b7 = s1.Otherwise(); b7.SetHeader("branch", "fallback"); b7.SetBody("FALLBACK"); s1.EndChoice(); var s8 = route0.Log(LogLevel.Information); s8.ShowRouteId(); s8.Message("route complete"); s8.EndLog(); // TryCatch with a rich log in catch var route9 = From("direct://demo-trycatch-richlog"); route9.RouteId("demo-trycatch-richlog"); route9.Description("TryCatch with a rich log in catch"); var s10 = route9.Choice(); var b11 = s10.When(Context!.GetFromRegistry("isNonEmptyString")!); var s12 = b11.TryCatch(); s12.ThrowException(typeof(global::System.InvalidOperationException), "boom"); var b13 = s12.Catch(typeof(global::System.InvalidOperationException)); b13.Log("[tmpl] caught: ${exception.type} - ${exception.message} [${routeId}]"); var s14 = b13.Log(LogLevel.Warning); s14.ShowRouteId(); s14.Message("[rich-tmpl] ${exception.type}: ${exception.message}"); s14.EndLog(); b13.SetHeader("caught", "true"); b13.EndCatch(); s12.EndTryCatch(); s10.EndChoice(); // Nested scopes: choice - when - split - richLog var route15 = From("direct://demo-nested-scopes"); route15.RouteId("demo-nested-scopes"); route15.Description("Nested scopes: choice - when - split - richLog"); var s16 = route15.Choice(); var b17 = s16.When("true"); var s18 = b17.Split(Expr("body")); var s19 = s18.Log(LogLevel.Information); s19.Message("inside"); s19.EndLog(); s18.Log("item=${body}"); s18.EndSplit(); s16.EndChoice(); route15.SetHeader("after-close", "ok"); route15.Log("nested scopes demo done"); } }