<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: rinat kozin</title>
    <description>The latest articles on DEV Community by rinat kozin (@rinat_kozin).</description>
    <link>https://dev.to/rinat_kozin</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3929984%2F9dcd2f94-0b1b-4161-9693-3e8c3f6ce385.jpg</url>
      <title>DEV Community: rinat kozin</title>
      <link>https://dev.to/rinat_kozin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rinat_kozin"/>
    <language>en</language>
    <item>
      <title>JSONB or typed classes: what the PostgreSQL planner sees</title>
      <dc:creator>rinat kozin</dc:creator>
      <pubDate>Tue, 24 Nov 2026 09:46:02 +0000</pubDate>
      <link>https://dev.to/rinat_kozin/jsonb-or-typed-classes-what-the-postgresql-planner-sees-1o9n</link>
      <guid>https://dev.to/rinat_kozin/jsonb-or-typed-classes-what-the-postgresql-planner-sees-1o9n</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcmatke8kdks8kw7hom8w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcmatke8kdks8kw7hom8w.png" alt="redb.Core" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Franck Pachot's JSONB example on our server and the same question in redb Pro: plans, row estimates and plain figures.&lt;/p&gt;

&lt;p&gt;Franck Pachot recently took apart a simple case on dev.to (&lt;a href="https://dev.to/franckpachot/jsonb-performance-declare-access-patterns-to-postgresql-query-planner-2cip"&gt;JSONB performance: declare access patterns to PostgreSQL query planner&lt;/a&gt;). A table holds 100,000 measurements, each in a JSONB column. The query counts the measurements where three values are zero and groups them by lab. &lt;code&gt;ANALYZE&lt;/code&gt; collects statistics for the JSONB column as a whole, not for the keys inside the document. For a condition like &lt;code&gt;(record-&amp;gt;&amp;gt;'value_1')::INT = 0&lt;/code&gt;, with no index and no statistics on that expression, the planner has nothing to go on: it takes the default equality selectivity, 0.5%, for each of the three conditions and multiplies them. 100,000 × 0.005³ is a hundredth of a row, so the estimate becomes one row. In fact about 12,500 rows match, and the plan comes out wrong. The cure is to declare the access pattern: expression indexes, a compound expression index or extended statistics.&lt;/p&gt;

&lt;p&gt;We ran his example on our server and asked redb the same question, where the data has C# classes and every field has a type. Below are the plans, the row estimates and the times. The result first: on this query JSONB with a hand-made index is faster than redb. What typing buys for that is further down.&lt;/p&gt;

&lt;h2&gt;
  
  
  His case on our server
&lt;/h2&gt;

&lt;p&gt;The table &lt;code&gt;measurements(tick BIGSERIAL, record JSONB)&lt;/code&gt;, 100,000 rows, with &lt;code&gt;value_1&lt;/code&gt;, &lt;code&gt;value_2&lt;/code&gt;, &lt;code&gt;value_3&lt;/code&gt; (0 or 1) and &lt;code&gt;scientist_id&lt;/code&gt; in the document. A lookup table &lt;code&gt;scientist_labs&lt;/code&gt; with 10,000 scientists and three lab names. The query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lab_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;COUNT&lt;/span&gt;&lt;span class="cm"&gt;(*)
FROM measurements m
JOIN scientist_labs s ON s.scientist_id = (m.record-&amp;gt;&amp;gt;'scientist_id')::BIGINT
WHERE (m.record-&amp;gt;&amp;gt;'value_1')::INT = 0
  AND (m.record-&amp;gt;&amp;gt;'value_2')::INT = 0
  AND (m.record-&amp;gt;&amp;gt;'value_3')::INT = 0
GROUP BY s.lab_name
ORDER BY s.lab_name
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;PostgreSQL 18.6, &lt;code&gt;jit = off&lt;/code&gt;. The time is a plain run of the statement, the median of three warm runs (why not &lt;code&gt;EXPLAIN ANALYZE&lt;/code&gt; is explained at the end):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Variant&lt;/th&gt;
&lt;th&gt;Estimated / actual rows&lt;/th&gt;
&lt;th&gt;Join&lt;/th&gt;
&lt;th&gt;ms&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;no index&lt;/td&gt;
&lt;td&gt;1 / 12,491&lt;/td&gt;
&lt;td&gt;Nested Loop&lt;/td&gt;
&lt;td&gt;29.7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;three expression indexes&lt;/td&gt;
&lt;td&gt;12,589 / 12,491&lt;/td&gt;
&lt;td&gt;Hash Join&lt;/td&gt;
&lt;td&gt;25.9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;compound index on the three expressions&lt;/td&gt;
&lt;td&gt;12,481 / 12,491&lt;/td&gt;
&lt;td&gt;Hash Join&lt;/td&gt;
&lt;td&gt;11.1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;extended statistics only&lt;/td&gt;
&lt;td&gt;7,263 × 2 / 6,245 × 2&lt;/td&gt;
&lt;td&gt;Hash Join&lt;/td&gt;
&lt;td&gt;26.5&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The one-row estimate reproduces. The best variant, as in his article, is the compound index: 11.1 ms.&lt;/p&gt;

&lt;h2&gt;
  
  
  The same data in redb
&lt;/h2&gt;

&lt;p&gt;In redb, data is described by a class. Pachot's document is closest to a class with a nested class: the values and the lab details live in the measurement itself.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LabInfo&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;LabName&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;RedbScheme&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"pachot_measurement_nested"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;NestedMeasurementProps&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nc"&gt;Value1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nc"&gt;Value2&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nc"&gt;Value3&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;LabInfo&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="nc"&gt;Lab&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One difference from his schema is worth naming at once. His document holds &lt;code&gt;scientist_id&lt;/code&gt;, and the lab name comes from the lookup table. Here the lab name lives in the measurement as a field of the nested class, so the query needs no lookup. The distributions are the same: the values 0 and 1 are equally likely and independent, the lab is picked uniformly out of 10,000, the name by &lt;code&gt;(i % 3) + 1&lt;/code&gt;. The data is seeded with a fixed seed.&lt;/p&gt;

&lt;p&gt;The question is the same, and it is one query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;groups&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;redb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Query&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;NestedMeasurementProps&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Value1&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Value2&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Value3&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;GroupBy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Lab&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;LabName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SelectAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The compiler checks the field names and their types. &lt;code&gt;Value1&lt;/code&gt; is an &lt;code&gt;int&lt;/code&gt; here and is compared with an &lt;code&gt;int&lt;/code&gt;. There is no &lt;code&gt;::INT&lt;/code&gt; cast in the query, because in the database it is a number, not text inside a document.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the planner sees
&lt;/h2&gt;

&lt;p&gt;redb Pro turns this query into one SQL statement:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="nb"&gt;COALESCE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;json_agg&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;row_to_json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="kt"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'[]'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
  &lt;span class="n"&gt;pvt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="s2"&gt;"Lab.LabName"&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="s2"&gt;"LabName"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nb"&gt;COUNT&lt;/span&gt;&lt;span class="cm"&gt;(*) AS "Count"
FROM (
  SELECT o_src._id AS _id_object, f0._string AS "Lab.LabName", o_src._dv AS "Value1", f2._long AS "Value2", f3._long AS "Value3"
  FROM (SELECT dv._id_object AS _id, dv._long AS _dv FROM _values dv WHERE (dv._id_structure = '1000016' AND dv._long = '0') AND dv._array_index IS NULL AND dv._id_object NOT IN (SELECT t._id FROM _objects t WHERE t._id_scheme = -10)) o_src
  LEFT JOIN _values f0 ON f0._id_object = o_src._id AND f0._id_structure = '1000020' AND f0._array_index IS NULL
  LEFT JOIN _values f2 ON f2._id_object = o_src._id AND f2._id_structure = '1000017' AND f2._array_index IS NULL
  LEFT JOIN _values f3 ON f3._id_object = o_src._id AND f3._id_structure = '1000018' AND f3._array_index IS NULL
) pvt
WHERE ((pvt."Value1" = '0' AND pvt."Value2" = '0') AND pvt."Value3" = '0')
GROUP BY pvt."Lab.LabName"
) t
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The outer &lt;code&gt;json_agg&lt;/code&gt; is the transport of the grouped result: the three group rows go to .NET as one JSON. The query itself is inside.&lt;/p&gt;

&lt;p&gt;Each field is stored as a row of the values table: &lt;code&gt;_id_structure&lt;/code&gt; says which field it is, and the value sits in the column of its type. Integers go to &lt;code&gt;_long&lt;/code&gt;, strings to &lt;code&gt;_string&lt;/code&gt;. To the planner, the condition &lt;code&gt;Value1 = 0&lt;/code&gt; is &lt;code&gt;_id_structure = X AND _long = 0&lt;/code&gt;, a plain comparison of two columns that have statistics. There are no expressions to declare.&lt;/p&gt;

&lt;p&gt;We created no index for this query. The system index &lt;code&gt;IX__values__structure_long_object&lt;/code&gt; does the work, one index for every int field of every class in the database. Add another &lt;code&gt;int&lt;/code&gt; field to the class tomorrow and filter on it, and the index is already there.&lt;/p&gt;

&lt;p&gt;The source of the query is built from the first condition: the &lt;code&gt;o_src&lt;/code&gt; subquery reads only the &lt;code&gt;Value1 = 0&lt;/code&gt; rows, about 50,000, not all 100,000 objects. The other conditions and the lab name are joined to that set, and &lt;code&gt;GROUP BY&lt;/code&gt; gets only the 12,459 matching objects.&lt;/p&gt;

&lt;p&gt;The plan: a parallel Hash Join of two index-only scans for &lt;code&gt;Value1 = 0&lt;/code&gt; and &lt;code&gt;Value2 = 0&lt;/code&gt;, then an index-only lookup of &lt;code&gt;Value3 = 0&lt;/code&gt; per row, then a lookup of the lab name per match, a sort and a grouping.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the estimates go wrong
&lt;/h2&gt;

&lt;p&gt;redb has its own statistics weakness, and the same plan shows it:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Node&lt;/th&gt;
&lt;th&gt;Estimated&lt;/th&gt;
&lt;th&gt;Actual&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;Value1 = 0&lt;/code&gt; rows&lt;/td&gt;
&lt;td&gt;about 18,000&lt;/td&gt;
&lt;td&gt;49,969&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;after &lt;code&gt;Value2&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;864 per worker&lt;/td&gt;
&lt;td&gt;24,863&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;after &lt;code&gt;Value3&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;101 per worker&lt;/td&gt;
&lt;td&gt;12,459&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;groups&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The planner estimates one field reasonably well. But three fields of one object are three rows of the values table, and when it joins them by &lt;code&gt;_id_object&lt;/code&gt; the planner treats them as independent. Each further condition multiplies the error, and by the end the estimate is 51 times below the actual count. Extended statistics cannot help here: they work on columns of one row, and these fields sit in different rows.&lt;/p&gt;

&lt;p&gt;This time the error cost little: the low estimate chose an index lookup per row, and each such lookup is one index probe.&lt;/p&gt;

&lt;h2&gt;
  
  
  The figures
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Variant&lt;/th&gt;
&lt;th&gt;Steps&lt;/th&gt;
&lt;th&gt;ms&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;JSONB, no index&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;29.7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;JSONB, compound expression index&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;11.1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;redb Pro, nested class, one &lt;code&gt;GroupBy&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;50.5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;redb Pro, tree, grouping by parent&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;67.6&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Every redb variant returns the same answer, and it matches a count over the seeded data in .NET: California Scientific 4192, Industrial Labs 4179, Western Science People 4088.&lt;/p&gt;

&lt;p&gt;The tree row is the same task in another model: the lab is the parent, its measurements are child objects. The first step groups the matching measurements by parent in one statement (&lt;code&gt;GroupByRedb(m =&amp;gt; m.ParentId)&lt;/code&gt;, 49.6 ms); the second reads the lab names in two statements (17.5 ms). With a few small service statements, the server total is 67.6 ms.&lt;/p&gt;

&lt;p&gt;On Pachot's question, a JSONB document with an index made by hand for this query is two to five times faster than redb: 11.1 and 29.7 ms against 50.5. Through the redb API, with the result parsed in .NET, it is 53.5 ms.&lt;/p&gt;

&lt;h2&gt;
  
  
  What types and foreign keys buy for that price
&lt;/h2&gt;

&lt;p&gt;Pachot writes that with JSONB you declare the access paths to the planner yourself: which expressions, which index, which statistics. That is work done for every query that has to be fast, and redone when the query changes.&lt;/p&gt;

&lt;p&gt;In redb, data has a type and relations from the start:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a field is declared in a C# class, and a query on it is checked by the compiler instead of failing on a typo in the string &lt;code&gt;'value_1'&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;an &lt;code&gt;int&lt;/code&gt; is stored as a number, with no cast from text in every condition;&lt;/li&gt;
&lt;li&gt;the indexes on the values tables are the same for every class; a new query does not add any;&lt;/li&gt;
&lt;li&gt;a new field in a class needs neither a table migration nor a new index;&lt;/li&gt;
&lt;li&gt;relations are held by foreign keys. Every value is tied to its object and to the definition of its field; the parent in a tree is a foreign key to an object, and so is a reference field to another object (&lt;code&gt;RedbObject&amp;lt;T&amp;gt;&lt;/code&gt;). In Pachot's document, &lt;code&gt;scientist_id&lt;/code&gt; is just a number inside JSON: the database will not check that such a scientist exists, and will not stop you from deleting a scientist the measurements refer to.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The price in our measurement: 50 ms where JSONB with a hand-made index answers in 11. If there is one hot query, the compound expression index wins. If there are many queries and they change along with the code, typing spares you a declaration for each of them.&lt;/p&gt;

&lt;h2&gt;
  
  
  How we measured
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;PostgreSQL 18.6 in a container, AMD Ryzen 5 5500U, &lt;code&gt;jit = off&lt;/code&gt;, &lt;code&gt;work_mem = 64MB&lt;/code&gt;, &lt;code&gt;shared_buffers = 4GB&lt;/code&gt;, &lt;code&gt;random_page_cost = 1.1&lt;/code&gt;. A separate database; nothing else ran on the server meanwhile.&lt;/li&gt;
&lt;li&gt;redb Pro from the development branch, query planner on, default configuration.&lt;/li&gt;
&lt;li&gt;Each figure is the median of three warm runs after one warm-up run.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Times are from plain runs.&lt;/strong&gt; This server's kernel reads time through &lt;code&gt;hpet&lt;/code&gt; (&lt;code&gt;tsc&lt;/code&gt; is not offered), and one clock read costs 1.2 µs. &lt;code&gt;EXPLAIN (ANALYZE)&lt;/code&gt; reads the clock for every row at every node, which here inflates the time 5 to 19 times. So the tables show the plain execution time of the statement, while the plans and row estimates come from &lt;code&gt;EXPLAIN (ANALYZE, BUFFERS)&lt;/code&gt;. For comparison, with timing on, the compound index showed 102 ms and the redb nested class 280 ms. For the same reason our figures cannot be compared with those in his article, only with each other.&lt;/li&gt;
&lt;li&gt;The JSONB data was seeded with &lt;code&gt;random()&lt;/code&gt;, as in his article, and gave 12,491 matching rows. The redb data was seeded from &lt;code&gt;new Random(20261124)&lt;/code&gt; and gave 12,459.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Franck, if you read this: we would like your view on how the planner handles fields that live in different rows of one table, and what could be done better there.&lt;/p&gt;

&lt;p&gt;Code and documentation: &lt;a href="https://github.com/redbase-app/redb" rel="noopener noreferrer"&gt;github.com/redbase-app/redb&lt;/a&gt;, articles: &lt;a href="https://redbase.app/articles" rel="noopener noreferrer"&gt;redbase.app/articles&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;If this was useful, a ⭐ on &lt;a href="https://github.com/redbase-app/redb" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; helps others find it.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>postgressql</category>
      <category>dotnet</category>
      <category>database</category>
      <category>performance</category>
    </item>
    <item>
      <title>For consultancies: building integration projects faster and handing them over without pain</title>
      <dc:creator>rinat kozin</dc:creator>
      <pubDate>Fri, 20 Nov 2026 17:44:53 +0000</pubDate>
      <link>https://dev.to/rinat_kozin/for-consultancies-building-integration-projects-faster-and-handing-them-over-without-pain-41eg</link>
      <guid>https://dev.to/rinat_kozin/for-consultancies-building-integration-projects-faster-and-handing-them-over-without-pain-41eg</guid>
      <description>&lt;p&gt;How many hours of your last project went into work the client doesn't want to pay for as a separate line? The broker connection, retries and duplicate protection, database migrations, deployment, monitoring. In the estimate it hides under "architecture" and "integration", and the client still asks why it takes so long.&lt;/p&gt;

&lt;p&gt;I have been building backends for clients for over twenty years, and for the last three years and more I have built them on my own open source .NET ecosystem, redb. This article is about why it is a convenient stack for a firm that builds software for clients: what gets faster, what is easier to hand over, and where its honest limits are.&lt;/p&gt;

&lt;h2&gt;
  
  
  The same bricks at every client
&lt;/h2&gt;

&lt;p&gt;The ecosystem is a data store, the redb.Route integration engine, the redb.Tsak host for modules and the redb.Identity login server. Data is a C# class, a process is a route, an external system is an address string. Every client gets the same project structure.&lt;/p&gt;

&lt;p&gt;A project starts from a template. There are 21 for routes: files, Kafka, RabbitMQ, mail, REST, AS2, AS4, redb storage and more, plus templates for applications and a worker. In my experience the second project on this stack goes noticeably faster than the first, and the third faster than the second: decisions are not reinvented, and a new person on the team sees a familiar structure from day one.&lt;/p&gt;

&lt;h2&gt;
  
  
  An AI assistant that writes a route, not guesses
&lt;/h2&gt;

&lt;p&gt;For a firm that sells hours this is probably the main point. Every project created from a template already has an AGENTS.md file with rules for GitHub Copilot, Cursor, Codex and Claude Code: which elements to use, how to keep secrets, what to check. A route is written in a typed DSL, and the XML schema is generated from the real packages, so the assistant works with what actually exists.&lt;/p&gt;

&lt;p&gt;If it still makes up an option, the package check refuses it before deployment, names the file, line and column, and suggests the right name. The error is caught by a check on the developer's machine, not by the client's server. The assistant speeds the developer up but does not replace them: custom code with business calculations is still written in C#, and a person is responsible for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clean code, if you keep to the DSL
&lt;/h2&gt;

&lt;p&gt;Here is a route: read orders from Kafka, let only new ones through and send them to RabbitMQ.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="nc"&gt;From&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"kafka://orders?groupId=svc&amp;amp;brokers=localhost:9092"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isEqualTo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"new"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;To&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"rabbitmq://events?host=localhost"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same in XML:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;route&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"orders"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;from&lt;/span&gt; &lt;span class="na"&gt;uri&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"kafka://orders?groupId=svc&amp;amp;amp;brokers=localhost:9092"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;filter&lt;/span&gt; &lt;span class="na"&gt;expr&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"header.type == 'new'"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;to&lt;/span&gt; &lt;span class="na"&gt;uri&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"rabbitmq://events?host=localhost"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/filter&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/route&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Retries, error handling, transactions and dead letters are written in the same style. Code by different developers and from different projects looks the same, and reviews are not spent arguing about how to do it right. This is what a real route from a demo project looks like: schema validation, error handling, a decision and a reply in one transaction, with comments that read like a description of the process.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fosgnrpv1yugd833j2ko1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fosgnrpv1yugd833j2ko1.png" alt="An XML route in VS Code: validation, try/catch, a transaction and branching" width="800" height="587"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Hand-over: a diagram the client's analyst can read
&lt;/h2&gt;

&lt;p&gt;After a hand-over the client is usually left with code that one person understands, and that person is yours. Here the process is a route, and a route can be shown as a picture. The &lt;code&gt;redb-route-xml&lt;/code&gt; tool draws a Mermaid flowchart from an XML route:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;redb-route-xml mermaid routes/main.route.xml --bin bin/Debug/net10.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;GitHub, GitLab and many Markdown viewers render Mermaid. The client's analyst looks at the diagram and checks that the process works as agreed, with no developer in the room. There is a free VS Code extension that shows the same route as a graph over the XML, and the &lt;strong&gt;redb Route: Show Mermaid Diagram&lt;/strong&gt; command opens the Mermaid diagram in the next tab, no terminal needed:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fomd77hx2x2679hct4okj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fomd77hx2x2679hct4okj.png" alt="A route graph in the VS Code extension: try/catch, a transaction, branches" width="799" height="586"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The client depends less on one person, and you spend less time explaining.&lt;/p&gt;

&lt;h2&gt;
  
  
  A licence with no line in the estimate
&lt;/h2&gt;

&lt;p&gt;The core, the integration engine, the host and the login server are open source under Apache 2.0. The Pro packages are closed but free. Rather than paraphrase, here is what the Pro licence itself says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;install, configure, and run the Software, for any lawful purpose, including in commercial and production environments (§2.1 a)&lt;/p&gt;

&lt;p&gt;no limit on the number of developers, servers, or requests (§2.1 b)&lt;/p&gt;

&lt;p&gt;Allow the Licensee's employees, contractors, and agents to use the Software on the Licensee's behalf (§2.1 d)&lt;/p&gt;

&lt;p&gt;The Software is provided free of charge. No purchase, payment, license key, activation, subscription, or renewal is required (§2.2)&lt;/p&gt;

&lt;p&gt;Distributing an application that merely uses the Software as a dependency is permitted (§3.1 a)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For a consultancy this means: you build a solution for a client on redb, the client runs it in its own environment, and neither of you has to buy or activate anything. What is not allowed: distributing or selling the Pro packages themselves as a standalone product or library, and building a competing product on them (§3.1).&lt;/p&gt;

&lt;h2&gt;
  
  
  Everything inside the client's perimeter
&lt;/h2&gt;

&lt;p&gt;Nothing has to be ordered from a vendor: no SaaS, no licence server, and the system sends nothing out. The data lives in the client's database: PostgreSQL, SQL Server or SQLite. The client's security team reviews what it can see: NuGet packages, container images signed with cosign, and open source code. The closed Pro packages are not a black box either: we hand their source to companies for security review on request. For banks and public-sector clients this often settles the question before the pilot.&lt;/p&gt;

&lt;p&gt;It works at size too: for example, one project has over 1M objects and over 47M property values.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deployment: a module, not a release of the whole system
&lt;/h2&gt;

&lt;p&gt;The client's routes live as modules in the redb.Tsak host. What the DevOps team, the client's or yours, gets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Three ways to ship the host.&lt;/strong&gt; Ready Docker images (&lt;code&gt;redb-tsak-worker&lt;/code&gt;, &lt;code&gt;redb-tsak-web&lt;/code&gt;, &lt;code&gt;redb-tsak-stack&lt;/code&gt;), self-contained archives for Linux and Windows with no .NET install needed, or a host of your own built from NuGet in your pipeline: &lt;code&gt;dotnet new tsak-worker&lt;/code&gt; from &lt;code&gt;redb.Tsak.Templates&lt;/code&gt; gives a Worker Service on &lt;code&gt;services.AddTsak(configuration)&lt;/code&gt; with a Dockerfile.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verifiable artifacts.&lt;/strong&gt; Images and archives are signed with cosign, and the client's pipeline checks them with &lt;code&gt;cosign verify&lt;/code&gt; before deploying.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Storage to fit the job.&lt;/strong&gt; SQLite by default: one server, nothing to install. PostgreSQL or SQL Server for a cluster.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A module is one file.&lt;/strong&gt; A &lt;code&gt;.tpkg&lt;/code&gt; package goes into the &lt;code&gt;modules/&lt;/code&gt; folder or out with &lt;code&gt;tsak module deploy&lt;/code&gt;. The host starts the new version, the old one finishes the messages it has started and stops, and the other modules on the node don't notice. Rollback is &lt;code&gt;tsak module rollback&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A hint for the pipeline.&lt;/strong&gt; Before deploying, CI asks the node (&lt;code&gt;tsak system deploy-advice&lt;/code&gt;) whether the module can be swapped hot or needs the cold path, and gets the answer as an exit code any CI understands.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kubernetes.&lt;/strong&gt; Ready manifests, startup, live and ready probes, taking a node out of rotation (cordon) and back.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Observability.&lt;/strong&gt; A Prometheus endpoint, OpenTelemetry traces, a ready Grafana dashboard and a local Prometheus + Grafana + Jaeger stack in &lt;code&gt;docker compose&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API modes.&lt;/strong&gt; Full, headless with no ports for embedding, or read-only for monitoring. Next to them, the &lt;code&gt;tsak&lt;/code&gt; CLI and a client package for your own tooling (&lt;code&gt;services.AddTsakClient&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a consultancy this means a change for a client is one module, not a release of the whole system with a night-time window.&lt;/p&gt;

&lt;p&gt;The client sees what is going on by itself, without your developer: the dashboard shows every route with its traffic, errors and health.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq4ymzy74xtnste7e1y4e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq4ymzy74xtnste7e1y4e.png" alt="A Tsak node running the redb.Identity server: 199 endpoints, 15.2K messages, no errors" width="800" height="606"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It also has node monitoring: CPU, memory, threads and garbage collection, and next to it the list of modules, the scheduler, the log, the audit and the dead letters.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3b1wxoomq50k0xw4ttel.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3b1wxoomq50k0xw4ttel.png" alt="Monitoring of one Tsak node over the last hour" width="800" height="599"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Signed modules: you build, the client deploys
&lt;/h2&gt;

&lt;p&gt;A module can be signed. You create a key pair once (&lt;code&gt;tsak module keygen&lt;/code&gt;), sign each module package in your CI (&lt;code&gt;tsak module sign&lt;/code&gt;) and give the client the public key. The client's node with that key accepts only modules you signed: an unsigned or tampered package is refused. The client deploys updates itself, in its own Tsak, and you know for sure that it runs your build.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ready items for a proposal
&lt;/h2&gt;

&lt;p&gt;Some of what you usually have to promise as "we'll build it" is already there:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Document exchange with Europe.&lt;/strong&gt; The AS4 connector: version 4.6.1 passed the European Commission's conformance testing, 76 of 76 required tests, and redb.Route.As4 is on the &lt;a href="https://ec.europa.eu/digital-building-blocks/sites/spaces/DIGITAL/pages/721846393/eDelivery+AS4+v1.x+conformant+products" rel="noopener noreferrer"&gt;list of eDelivery AS4 conformant products&lt;/a&gt; (Common Profile). For a client whose EU partner has written AS4 into the contract, that is a ready answer instead of a separate Java gateway in the estimate. Details in the &lt;a href="https://redbase.app/articles/as4-edi" rel="noopener noreferrer"&gt;AS4 article&lt;/a&gt;. AS2 is next to it for partners that use that.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integrations.&lt;/strong&gt; 30 transport packages: Kafka, RabbitMQ, IBM MQ, SQL, HTTP, SOAP, SFTP, mail, cloud queues and more.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Operations.&lt;/strong&gt; The host dashboard: routes, errors, dead letters, the log, metrics, the cluster.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fumkgwg2x6zz92vmomiag.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fumkgwg2x6zz92vmomiag.png" alt="The European Commission's conformance certificate, eDelivery AS4 Profile v1.16, redb.Route.As4 v4.6.1" width="800" height="529"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Several clients on one ecosystem means a separate database for each. There is no special "multi-tenant mode": isolation is by database, which is also easier to explain to a security team.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Frequent releases.&lt;/strong&gt; There is no long-term support branch. The current 4.7.x line gets fixes for critical defects and fixes on request; from 4.8.0 the packages target .NET 10 and 11 only. Plan updates into maintenance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Somebody runs the host.&lt;/strong&gt; The server, the OS, TLS and database backups are the client's administrator's job, or yours if you sell it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your own code stays yours.&lt;/strong&gt; Business calculations and a connector that is not on the list are written in C#.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I suggest
&lt;/h2&gt;

&lt;p&gt;Don't move every client at once. Take one client and one integration that hurts today, build it on redb and compare the hours with the way you usually do it.&lt;/p&gt;

&lt;p&gt;Code and documentation: &lt;a href="https://github.com/redbase-app" rel="noopener noreferrer"&gt;github.com/redbase-app&lt;/a&gt;, articles: &lt;a href="https://redbase.app/articles" rel="noopener noreferrer"&gt;redbase.app/articles&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Which part of your projects repeats from client to client, and how many hours does it eat? Tell us in the comments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;If this was useful, a ⭐ on &lt;a href="https://github.com/redbase-app" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; helps others find it.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>devops</category>
      <category>architecture</category>
      <category>opensource</category>
    </item>
    <item>
      <title>How many people does a business application take? The redb ecosystem and a short answer</title>
      <dc:creator>rinat kozin</dc:creator>
      <pubDate>Thu, 19 Nov 2026 20:04:10 +0000</pubDate>
      <link>https://dev.to/rinat_kozin/how-many-people-does-a-business-application-take-the-redb-ecosystem-and-a-short-answer-jd8</link>
      <guid>https://dev.to/rinat_kozin/how-many-people-does-a-business-application-take-the-redb-ecosystem-and-a-short-answer-jd8</guid>
      <description>&lt;p&gt;Half of a team writes not the business but everything around it. How **redb **takes that half off your hands, and why with it an analyst with AI can build an integration.&lt;/p&gt;

&lt;p&gt;How many people on your team write the wrapping around the business? The broker connection, the database migration, the zero-downtime deployment, the dashboard, the login. It has to be done, it costs money, and it is the same everywhere. You pay for that work again in every project, and now you pay for it in tokens too: the AI writes the same plumbing, gets it wrong and rewrites it on your bill.&lt;/p&gt;

&lt;p&gt;redb has already written that part. It is an open .NET ecosystem: data storage, an integration engine, a host for modules and a login server. This article is about how many people and how much AI work are left when everything around the business is already there.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it looks like
&lt;/h2&gt;

&lt;p&gt;Three rules.&lt;/p&gt;

&lt;p&gt;Data is a class. You write a plain C# class, put an attribute on it, and redb stores it in PostgreSQL, SQL Server or SQLite:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;RedbScheme&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"employee"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;EmployeeProps&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;FirstName&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;decimal&lt;/span&gt; &lt;span class="nc"&gt;Salary&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="nc"&gt;Skills&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A process is a route. For example: pick up XML files from a folder, check them against a schema and send them to Kafka. A good file moves to &lt;code&gt;done&lt;/code&gt;, a bad one to &lt;code&gt;error&lt;/code&gt;, where a person can look at it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;route&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"orders-in"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;from&lt;/span&gt; &lt;span class="na"&gt;uri&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"file://inbox?antInclude=*.xml&amp;amp;amp;moveTo=done&amp;amp;amp;moveFailed=error"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;convertBody&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"System.String"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;validateXsd&lt;/span&gt; &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"resources/order.xsd"&lt;/span&gt; &lt;span class="na"&gt;throwOnFailure&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;to&lt;/span&gt; &lt;span class="na"&gt;uri&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"kafka://orders?brokers=kafka:9092"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/route&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An external system is an address string. &lt;code&gt;file://&lt;/code&gt;, &lt;code&gt;kafka://&lt;/code&gt;, &lt;code&gt;sftp://&lt;/code&gt;, &lt;code&gt;soap://&lt;/code&gt;, &lt;code&gt;as4://&lt;/code&gt;: redb.Route has 30 transport packages and 53 address schemes, from brokers and databases to mail, SOAP and European document exchange. To connect to a system, you name its connector.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the hours go
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Tables and migrations.&lt;/strong&gt; A new entity usually starts with a meeting: which tables, which relations, which indexes, who writes the migration. Here an entity is a class. Foreign keys, indexes and uniqueness are already in place, and the schema follows the class at startup. The limit: a field removed from the class is removed from the database by default. When an old and a new version of the application run side by side, you turn that mode off.&lt;/p&gt;

&lt;p&gt;One example shows it best. The business says: "Let's keep an employee's skills, several of them." In a usual schema that is a fork. Either a separate table: a migration, a foreign key, an index, a join in every query, mapping code. Or a JSON string: cheap today, awkward to search by element, and redone at the next change of requirements. Even with AI that is hours: the model writes either option, but choosing, checking and later redoing it is people's work.&lt;/p&gt;

&lt;p&gt;In redb it is one line in the class above, &lt;code&gt;public string[]? Skills&lt;/code&gt;. You can search right away:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;devs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;redb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Query&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;EmployeeProps&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Skills&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Skills&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Contains&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"C#"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Skills&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Contains&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Python"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ToListAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each skill is stored as its own row with a foreign key to the employee. The developer describes what an employee is, and the system decides how to lay it out in tables. That is why the business can afford to experiment: a new field is one more property of a class.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Speed.&lt;/strong&gt; The usual question: isn't this slower than "normal tables"? We checked on the same employee model, which a usual schema spreads over 41 tables. We took the 98 tasks EF Core can do without raw SQL and timed one run of each: redb Pro on PostgreSQL took 189 ms on average, EF Core 703 ms. EF Core is faster where data is flat or where there are many small saves of one object each. If that is your profile, use EF Core. Every example with its time and query count is on the &lt;a href="https://redbase.app/results" rel="noopener noreferrer"&gt;results page&lt;/a&gt;, and anyone can repeat the run.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnjaju2inudfm8c34kr3o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnjaju2inudfm8c34kr3o.png" alt="Mean and median time per example, redb and EF Core, 98 examples" width="800" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Integrations.&lt;/strong&gt; A broker connection with retries, dead letters and deduplication usually takes a week to write and a month to fix. Here it is an address string plus ready integration patterns: retry, content-based routing, aggregation, idempotent intake. A transaction in a route is one word: first the database commits, then the sends to brokers go out, then the incoming message is acknowledged, always in that order. The limit: it is not a distributed transaction. HTTP, mail and files run at once, and processes that last hours need a pattern of their own.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deployment and operations.&lt;/strong&gt; Routes live as modules in the redb.Tsak host. You drop a new module into a folder, and the host picks it up without stopping the other modules or losing messages in flight. The dashboard, metrics, OpenTelemetry traces and the log are already there. A message a route sent to the host's dead letter queue is replayed or discarded by an operator from the console, with no developer woken up for it. There is a cluster with leader election and signed images. The limit: the server, the OS, TLS and database backups are still your administrator's job, there is just less of it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Login.&lt;/strong&gt; redb.Identity is an OAuth 2.1 and OpenID Connect server that installs as a package. We run it against the OpenID Foundation's official test suite: no module fails in the Basic OP and Config OP plans. Three modules need a person to take a screenshot in the browser; they last passed by hand in July. We don't carry the OpenID Certified mark, which is a separate paid procedure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Document exchange with Europe.&lt;/strong&gt; If your partner in the EU requires AS4 (e-invoicing, customs, energy, the public sector), the usual answer is a separate Java server next to the application. Here it is a connector. In November its version 4.6.1 passed the European Commission's conformance testing: eDelivery AS4 Profile 1.16, Common Profile, 76 of 76 required tests. The Commission has put redb.Route.As4 on its &lt;a href="https://ec.europa.eu/digital-building-blocks/sites/spaces/DIGITAL/pages/721846393/eDelivery+AS4+v1.x+conformant+products" rel="noopener noreferrer"&gt;list of conformant products&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fumkgwg2x6zz92vmomiag.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fumkgwg2x6zz92vmomiag.png" alt="The European Commission's conformance certificate, eDelivery AS4 Profile v1.16, redb.Route.As4 v4.6.1" width="800" height="529"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The limit: the certificate is for 4.6.1, later versions have not been through the tests again. It covers the eDelivery common profile. Peppol has a profile of its own, and we have not been tested against it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The analyst and the AI
&lt;/h2&gt;

&lt;p&gt;With the redb libraries, an analyst with AI can run an integration project.&lt;/p&gt;

&lt;p&gt;Here is how it works. The analyst knows the process: where an order comes from, what to do with it, where to send it. The AI knows the markup. The ecosystem knows the technology. The analyst states the task in words, the AI builds an XML route from ready connectors and patterns, and then the checks take over.&lt;/p&gt;

&lt;p&gt;Every project created from a template already has an AGENTS.md file with rules for GitHub Copilot, Cursor, Codex and Claude Code: elements only from the schema, secrets only as configuration keys. The markup schema is generated from the real packages. If the model still makes up an element or an option, the package check refuses it before deployment: it names the file, line and column, and answers a typo with "'perod' is not an option of the Timer endpoint. Did you mean 'period'?". The VS Code extension completes from the schema and draws the route as a graph: the analyst looks at the picture and sees whether the process is built right.&lt;/p&gt;

&lt;p&gt;The analyst checks what the process means; the machine checks the syntax. That is where the savings come from. Fewer people in the chain: no developer translating the analyst's words into code and then explaining why it came out wrong. And a shorter loop of "the AI wrote it, it failed, the AI rewrote it": the check catches the error before it reaches a server. We have not measured how many tokens this saves.&lt;/p&gt;

&lt;p&gt;The limit: an analyst with AI builds routes from what is there. That is connectors, integration patterns, calls to your services, redb objects. Your own code with business calculations is written in C#, and that is a developer's work. A connector that is not on the list is C# work too. The developer stays on the team and no longer writes the plumbing.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it costs and what you risk
&lt;/h2&gt;

&lt;p&gt;In money, nothing. The core, the integration engine, the host and the login server are open source under Apache 2.0. The Pro packages are closed but free: no key, no limits, commercial use included. Everything runs inside your perimeter, the data stays in your database, and nothing goes out. The open part lives in four public repositories, tests included.&lt;/p&gt;

&lt;p&gt;Releases come often: eight weeks from 4.0 to 4.7. There is no long-term support branch, but the 4.7.x line gets fixes for critical defects and fixes on request. It is the last line on .NET 8 and 9: Microsoft ended their support on 10 November, and from 4.8.0 on the packages target .NET 10 and 11 only. And somebody has to run the host: ordinary administrator work.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to try it in a day
&lt;/h2&gt;

&lt;p&gt;One &lt;code&gt;redb-tsak-stack&lt;/code&gt; container brings up the host and the dashboard on SQLite, with no external database and no key. One template creates a route project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet new install redb.Templates
dotnet new redb-route-file -n Orders
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are 21 route templates: files, Kafka, RabbitMQ, mail, REST, AS2, AS4, redb storage and more. The module goes into the &lt;code&gt;modules/&lt;/code&gt; folder, the host picks it up, and the route shows up on the dashboard.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we suggest
&lt;/h2&gt;

&lt;p&gt;Not a migration. A pilot: one module, one integration that hurts you today. Take a process a developer looks after now, give it to an analyst with AI, and see how many people and how much time it takes. If it doesn't fit, you lose a day.&lt;/p&gt;

&lt;p&gt;Code and documentation: &lt;a href="https://github.com/redbase-app" rel="noopener noreferrer"&gt;github.com/redbase-app&lt;/a&gt;. More on what the ecosystem replaces and what it costs in the &lt;a href="https://redbase.app/articles/redb-business-case" rel="noopener noreferrer"&gt;article for those choosing a platform&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Which integration would you hand to an analyst first? Tell us in the comments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;If this was useful, a ⭐ on &lt;a href="https://github.com/redbase-app" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; helps others find it.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>business</category>
      <category>architecture</category>
      <category>ai</category>
    </item>
    <item>
      <title>The tests were green, a person found the hole: a vulnerability in our OpenID server, start to finish</title>
      <dc:creator>rinat kozin</dc:creator>
      <pubDate>Tue, 17 Nov 2026 20:18:09 +0000</pubDate>
      <link>https://dev.to/rinat_kozin/the-tests-were-green-a-person-found-the-hole-a-vulnerability-in-our-openid-server-start-to-finish-9fj</link>
      <guid>https://dev.to/rinat_kozin/the-tests-were-green-a-person-found-the-hole-a-vulnerability-in-our-openid-server-start-to-finish-9fj</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdq2tq3656o7mc7omol98.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdq2tq3656o7mc7omol98.png" alt="redb.Identity" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How many green tests does it take to believe a protection works? We have about two thousand, and they pass on three databases. A person still found the hole: an outside researcher who worked through our server and saw a connection where we had seen none.&lt;/p&gt;

&lt;p&gt;This is the story of &lt;a href="https://github.com/redbase-app/redb-identity/security/advisories/GHSA-vmj2-8phj-mfxf" rel="noopener noreferrer"&gt;GHSA-vmj2-8phj-mfxf&lt;/a&gt; in redb.Identity, our OAuth 2.1 / OpenID Connect server for .NET. In order and with dates: what was broken, why we did not see it ourselves, how we fixed it and how we disclosed it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The report
&lt;/h2&gt;

&lt;p&gt;On 4 November a private report on version 4.6.1 came in. Its author, Rathnadeepan (HotWater, &lt;a href="https://github.com/HotWater-015" rel="noopener noreferrer"&gt;HotWater-015&lt;/a&gt; on GitHub), did not open a public issue or write a blog post about it. He wrote to us directly and left us time to fix it.&lt;/p&gt;

&lt;p&gt;We checked the report against the source the same day. It was all true.&lt;/p&gt;

&lt;h2&gt;
  
  
  DPoP in two paragraphs
&lt;/h2&gt;

&lt;p&gt;A plain access token is accepted from anyone who presents it. If it is stolen from a log, a proxy or an intermediate node, it can be used. &lt;a href="https://www.rfc-editor.org/rfc/rfc9449" rel="noopener noreferrer"&gt;DPoP (RFC 9449)&lt;/a&gt; changes that by binding the token to the client's key. The token carries the key's thumbprint (&lt;code&gt;cnf.jkt&lt;/code&gt;), and with every request the client sends a short proof signed by that key: method, URL, time, a one-time identifier and the hash of the token itself. Without the private key there is no proof, so a stolen token is useless.&lt;/p&gt;

&lt;p&gt;We wrote about this in detail in &lt;a href="https://redbase.app/articles/identity-token-theft" rel="noopener noreferrer"&gt;Your access token was stolen. Now what&lt;/a&gt;. That made it all the more unpleasant to learn that at two endpoints of our own server this protection did not work.&lt;/p&gt;

&lt;h2&gt;
  
  
  What was broken
&lt;/h2&gt;

&lt;p&gt;With DPoP enabled (&lt;code&gt;Dpop.Enabled = true&lt;/code&gt;, off by default), the server issues tokens bound to a key. The proof of possession was checked only when the token was issued, at &lt;code&gt;/connect/token&lt;/code&gt;. Two endpoints of the server itself, &lt;code&gt;/connect/userinfo&lt;/code&gt; and the management API &lt;code&gt;/api/v1/identity/...&lt;/code&gt; (SCIM included), read only the Bearer scheme and never looked at the &lt;code&gt;DPoP&lt;/code&gt; header.&lt;/p&gt;

&lt;p&gt;So a bound token was accepted there as a plain Bearer token: with no proof and without the key it is bound to. Someone who had obtained such a token, but not the client's private key, could read the user's claims at userinfo and use the management API within the token's scope.&lt;/p&gt;

&lt;p&gt;Affected: redb.Identity.Core versions 1.0.1 through 4.6.1 (fixed in 4.6.2), and only deployments with DPoP enabled. Resource servers that validate tokens with &lt;code&gt;redb.Identity.Resource.Dpop&lt;/code&gt; were not affected: the proof was always checked there. CVSS 3.1 score 7.4, High, class CWE-287 (improper authentication).&lt;/p&gt;

&lt;h2&gt;
  
  
  Why we did not see it
&lt;/h2&gt;

&lt;p&gt;Ever since DPoP arrived in the 1.x line, userinfo and the management API read only the Bearer scheme. Nobody looked at the &lt;code&gt;cnf&lt;/code&gt; field at these endpoints, and a bound token went through like any other.&lt;/p&gt;

&lt;p&gt;In October we moved to OpenIddict 7. Unlike version 6, it checks &lt;code&gt;cnf&lt;/code&gt; on every token, but it only understands certificate binding (&lt;code&gt;x5t#S256&lt;/code&gt;). On a token bound to a DPoP key it threw an exception, and in the 4.4.0 prereleases userinfo and the management API answered 500. That was the only period when a bound token did not get through at these endpoints, and the cause was an exception, not a check. We fixed the error: in front of the OpenIddict check we put a handler that turns it off for tokens with &lt;code&gt;jkt&lt;/code&gt;. The change description says it plainly: the DPoP proof is checked by Identity itself.&lt;/p&gt;

&lt;p&gt;That assumption was wrong: at these two endpoints nobody checked the proof, and from the 4.4.0 release on a bound token was accepted as Bearer again.&lt;/p&gt;

&lt;p&gt;Along with that fix came a test, "userinfo accepts a DPoP-bound token". It obtained a token, called userinfo with the Bearer scheme and a &lt;code&gt;DPoP&lt;/code&gt; header, and expected 200. The answer was 200, the test was green. But the server never read that header, and without it the answer would have been the same. The test checked that a good request goes through, and in doing so it locked in the very defect that a person from outside found later.&lt;/p&gt;

&lt;p&gt;The conclusion we drew: for a protection mechanism, a "must accept" test without a "must refuse" test proves almost nothing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The first day and night
&lt;/h2&gt;

&lt;p&gt;We confirmed the defect by reading the source the same day. We also checked how far back it went: the new tests were run on a commit that still used OpenIddict 6.3, and the token was accepted there too. Hence the range in the advisory, from 1.0.1.&lt;/p&gt;

&lt;p&gt;Then, in order:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;23:06, 4 November.&lt;/strong&gt; A failing test first: 18 cases on userinfo and the management API. A bound token as Bearer without a proof, as Bearer with a proof, a proof from another key, a replayed proof, a proof for another URL or method, an expired one, one without &lt;code&gt;ath&lt;/code&gt;; an unbound token under the DPoP scheme; and next to them a check that a plain unbound Bearer token is still accepted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;23:33.&lt;/strong&gt; The fix; the new tests green.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The night of 5 November.&lt;/strong&gt; Full runs on PostgreSQL, SQL Server and SQLite: 2007 tests on each database, none failed. Then the upgrade notes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;5 November.&lt;/strong&gt; Release 4.6.2.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now a bound token is accepted at these endpoints only under the &lt;code&gt;DPoP&lt;/code&gt; scheme with a valid proof: signed by the bound key, matching method and URL, &lt;code&gt;ath&lt;/code&gt; equal to the token hash, a fresh time, an unused &lt;code&gt;jti&lt;/code&gt;. Otherwise the answer is 401 with the challenge &lt;code&gt;WWW-Authenticate: DPoP error="invalid_token"&lt;/code&gt;. Plain unbound Bearer tokens and certificate-bound tokens work as before.&lt;/p&gt;

&lt;p&gt;Our management API is also available over gRPC and SOAP. There is nowhere to carry a DPoP proof there, so a bound token is now refused on these channels: gRPC answers &lt;code&gt;Unauthenticated&lt;/code&gt;, SOAP returns a fault. They need a plain Bearer token, or the HTTP API.&lt;/p&gt;

&lt;h2&gt;
  
  
  Disclosure
&lt;/h2&gt;

&lt;p&gt;The advisory stayed private until the reporter agreed to publication. We asked GitHub for a CVE number twice, on 5 and 11 November, and no number came. We did not wait longer: with the reporter's consent the advisory was published on 15 November under its GHSA identifier. If a CVE is assigned later, we will add it.&lt;/p&gt;

&lt;p&gt;Why the number is taking so long, we were not told. Our guess: vulnerabilities are being searched for very actively right now, breaches of large companies are reported all the time, and findings in small and open source projects are more numerous still. There seem to be so many CVE requests that GitHub cannot keep up. For a small project the conclusion is simple: publish the advisory yourself once the fix is out and the reporter agrees, and add the number when it arrives.&lt;/p&gt;

&lt;p&gt;By the time everyone learned about the hole, the fix had been on NuGet for ten days. That was possible because the reporter sent the finding to us, not to a public tracker, and gave us time to close it.&lt;/p&gt;

&lt;p&gt;Our side is to answer fast, fix fast, credit the reporter by name and publish the advisory even without a CVE number.&lt;/p&gt;

&lt;h2&gt;
  
  
  Holes like this are found by people
&lt;/h2&gt;

&lt;p&gt;Tests, release checks and our own review check what we imagined ourselves. If the developer's picture is "the proof is checked somewhere else", the test gets written for that picture and passes. Two thousand green tests say nothing about what is missing from the picture.&lt;/p&gt;

&lt;p&gt;This vulnerability did not sit in one line. It was assembled from several things that each looked harmless and had no obvious link to one another:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;endpoints that had read only the Bearer scheme since the first versions;&lt;/li&gt;
&lt;li&gt;a library check we switched off to get rid of a 500 error;&lt;/li&gt;
&lt;li&gt;the description of that change, saying the proof is checked elsewhere;&lt;/li&gt;
&lt;li&gt;a test that confirmed a good request goes through.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Someone had looked at each of these, and each one on its own was fine. They live in different places in the code and appeared in different months. To see the hole you have to hold all of them in your head at once and ask where the key is actually checked. Automated checks do not ask that question; they look at each part separately. Vulnerabilities like this are found by a person who studies the system and reasons about it.&lt;/p&gt;

&lt;p&gt;So a report from an outsider is, for us, a review he did on our behalf. Reports like this are very valuable to us, and I think to other projects too. Rathnadeepan, thank you.&lt;/p&gt;

&lt;p&gt;What do you think?&lt;/p&gt;

&lt;h2&gt;
  
  
  What we changed
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Refusal tests for every protected endpoint.&lt;/strong&gt; A separate test for each form of bad request, checking that the server refuses it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Demos on every built image.&lt;/strong&gt; Our own DPoP demo still called userinfo the old way after 4.6.2, with the Bearer scheme, and expected 200. We only noticed on 14 November, when we first ran the whole demo set against a full image built from the main branch: that step answered 401, as it should after the fix. The demo now follows RFC 9449, section 7.1: userinfo with the DPoP scheme, and the Bearer form must be refused. The demo set now runs on every full image build and in the checks before a release.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An advisory even without a CVE.&lt;/strong&gt; Users learn about a hole from our changelog and advisory, and do not wait for a number.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  If you use redb.Identity with DPoP
&lt;/h2&gt;

&lt;p&gt;Update &lt;code&gt;redb.Identity.Core&lt;/code&gt; to 4.6.2 or later: the fix lives there. Update &lt;code&gt;redb.Identity.Http&lt;/code&gt; along with it, so that userinfo answers the client with the DPoP challenge; with an older &lt;code&gt;redb.Identity.Http&lt;/code&gt; a token without a proof still gets 401, only the challenge comes in the Bearer form. Clients that obtain bound tokens and call userinfo or the management API need to send the &lt;code&gt;DPoP&lt;/code&gt; scheme and a proof with &lt;code&gt;ath&lt;/code&gt;; details in &lt;a href="https://github.com/redbase-app/redb-identity/blob/main/UPGRADING.md" rel="noopener noreferrer"&gt;UPGRADING.md&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you cannot update right away, there is no setting that restores the check. Shorten the access token lifetime and revoke tokens that may have leaked. If DPoP is off in your deployment, the defect does not affect you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Over to you
&lt;/h2&gt;

&lt;p&gt;How does this work in your projects? Is there a clear channel for security reports, and what happens when a report arrives: who reads it, how long does it wait for an answer? Have you waited weeks for a CVE number, and how did it end? And if you have found holes in someone else's code, how were you received? Tell us in the comments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;If this was useful, a ⭐ on &lt;a href="https://github.com/redbase-app" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; helps others find it.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;More of my writing: &lt;a href="https://redbase.app/articles" rel="noopener noreferrer"&gt;redbase.app/articles&lt;/a&gt;, and on &lt;a href="https://dev.to/rinat_kozin"&gt;dev.to&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>security</category>
      <category>oauth</category>
      <category>dpop</category>
    </item>
    <item>
      <title>Interestingly, dev.to doesn’t show my articles on engineering topics; it seems you either need to be working on a specific project or be an SMM specialist to get any visibility there.</title>
      <dc:creator>rinat kozin</dc:creator>
      <pubDate>Thu, 12 Nov 2026 23:20:30 +0000</pubDate>
      <link>https://dev.to/rinat_kozin/its-interesting-that-devto-isnt-showing-my-engineering-articles-either-its-an-issue-with-the-4l8f</link>
      <guid>https://dev.to/rinat_kozin/its-interesting-that-devto-isnt-showing-my-engineering-articles-either-its-an-issue-with-the-4l8f</guid>
      <description></description>
      <category>community</category>
      <category>discuss</category>
      <category>socialmedia</category>
    </item>
    <item>
      <title>The redb.Route expression language, part 2: from a string to IL, registry calls, and a gate that checks routes before they run</title>
      <dc:creator>rinat kozin</dc:creator>
      <pubDate>Tue, 10 Nov 2026 14:01:46 +0000</pubDate>
      <link>https://dev.to/rinat_kozin/the-redbroute-expression-language-part-2-from-a-string-to-il-registry-calls-and-a-gate-that-2pmg</link>
      <guid>https://dev.to/rinat_kozin/the-redbroute-expression-language-part-2-from-a-string-to-il-registry-calls-and-a-gate-that-2pmg</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F49k4fxco1y4wccwlxemu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F49k4fxco1y4wccwlxemu.png" alt="redb.Route" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://redbase.app/articles/route-expressions" rel="noopener noreferrer"&gt;The first part&lt;/a&gt; made the general case for the redb.Route expression language. It covered one grammar for conditions, values and templates, compilation into a delegate instead of interpretation per message, one truthiness rule, and the places where expressions live: patterns and endpoint addresses. This part goes underneath. It shows what exactly happens to a string such as &lt;code&gt;header.a &amp;gt; 10&lt;/code&gt;, how a template decides where a placeholder ends, how a route reaches your own services and the environment, what the language refuses to do when the text comes from data rather than from a developer, and what the package gate tells you about a route file before it is ever deployed.&lt;/p&gt;

&lt;p&gt;A note on where the results come from. The public guide to the language, &lt;a href="https://github.com/redbase-app/redb-route/blob/main/EXPRESSIONS.md" rel="noopener noreferrer"&gt;EXPRESSIONS.md&lt;/a&gt;, marks its example tables for execution, and a test (&lt;code&gt;ExpressionsGuideExamplesTests&lt;/code&gt;) reads the guide itself and runs every marked example, more than 130 of them, against the engine on every test run. When the engine changes, either the guide changes with it or the build fails. Every result below that comes from those tables is what the engine returns, not what it is meant to return. The few results that are not in the guide (the sandbox, prefix resolvers, the gate output) come from runs against the current code, and I say so where they appear.&lt;/p&gt;

&lt;p&gt;All examples run on one exchange:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;header.a = 42          header.b = 3            header.neg = -7        header.price = 2.5
header.s = "Hello World"                        header.flag = true     header.off = false
header.Content-Type = "text/xml"                header.empty = ""      header.O'Brien = "obrien"
header.user = { Name = "Ann", Age = 30, Active = true, Manager = { Name = "Bob", Age = 51 } }
header.list = [5, 1, 9]                         header.when = 2026-08-28 10:30 UTC
property.count = 7     property.items = ["p", "q", "r"]     property.nums = [1, 2, 3, 4]
property.cfg = { enabled = true, limit = 5 }    property.counter = 10
body = "payload"       exception.Message = "boom"
registry: beans "pricing" and "pricing-rules"; "limits.max", the number 100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  1. From a string to a delegate
&lt;/h2&gt;

&lt;p&gt;Most integration frameworks treat an expression string as something to interpret: every message walks the text, looks up functions by name and converts values on the way. redb.Route treats it as source code. The route is built once, and the expressions in it are compiled once into delegates of the shape &lt;code&gt;Func&amp;lt;IExchange, object?&amp;gt;&lt;/code&gt;. Each message only calls a delegate.&lt;/p&gt;

&lt;p&gt;Here is the path a bare expression takes.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Tokenizer.&lt;/strong&gt; The text is split into tokens: names, numbers, string literals, operators, parentheses. Whitespace between tokens disappears here, which is why &lt;code&gt;header.a&amp;gt;10&lt;/code&gt; and &lt;code&gt;header.a &amp;gt; 10&lt;/code&gt; are the same expression and a condition broken across lines in an XML attribute still reads correctly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parser.&lt;/strong&gt; A recursive descent parser builds a syntax tree. The precedence levels are the familiar ones, from the loosest to the tightest: ternary, &lt;code&gt;??&lt;/code&gt;, logic, comparison, addition and subtraction, multiplication and division, unary operators, and finally primary forms such as names, literals, calls and parentheses. The parser takes the whole text: a token left over after a complete expression is an error with its position, not something quietly dropped.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Expression tree.&lt;/strong&gt; Each node of the syntax tree is translated into &lt;code&gt;System.Linq.Expressions&lt;/code&gt;, the same expression trees that LINQ providers and Entity Framework build. A header read becomes a dictionary access and &lt;code&gt;upper(...)&lt;/code&gt; a method call. &lt;code&gt;AND&lt;/code&gt; and &lt;code&gt;OR&lt;/code&gt; become &lt;code&gt;AndAlso&lt;/code&gt; and &lt;code&gt;OrElse&lt;/code&gt; over the truthiness conversion, and &lt;code&gt;??&lt;/code&gt; becomes &lt;code&gt;Coalesce&lt;/code&gt;, so their right side runs only when the left one does not decide. &lt;code&gt;XOR&lt;/code&gt; needs both sides and evaluates both.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compile.&lt;/strong&gt; &lt;code&gt;Expression.Lambda&amp;lt;Func&amp;lt;IExchange, object?&amp;gt;&amp;gt;(...).Compile()&lt;/code&gt; turns the tree into IL. The result is an ordinary .NET delegate.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is the only engine. Every value expression, condition and placeholder goes through this one pipeline, so a form that works in one position works in the others with the same meaning and the same errors.&lt;/p&gt;

&lt;p&gt;Short-circuiting is not a detail. It is visible in the guide's executed rows, where the right side calls a bean that does not exist:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Expression&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;header.flag OR bean:nobody.Check()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;True&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;header.off AND bean:nobody.Check()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;False&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;header.a ?? bean:nobody.Check()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;42&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;None of the three ever calls &lt;code&gt;nobody&lt;/code&gt;. A guard on the left protects an expensive or fallible call on the right, as in C#.&lt;/p&gt;

&lt;p&gt;Templates take a slightly different road. A scanner first finds the holes in the text. A format suffix such as &lt;code&gt;${header.price:F2}&lt;/code&gt; is split off first (section 2). A placeholder that is the whole string, such as &lt;code&gt;${header.a}&lt;/code&gt;, has direct shortcuts: a header, a property, the body, a single &lt;code&gt;jpath&lt;/code&gt;/&lt;code&gt;xpath&lt;/code&gt; call and the Camel spellings &lt;code&gt;${jsonpath:...}&lt;/code&gt;, &lt;code&gt;${xpath:...}&lt;/code&gt; and &lt;code&gt;${file:...}&lt;/code&gt; compile straight to an accessor and skip the parser entirely. Anything richer goes through the same tree as a bare expression. A mixed template, with text around its placeholders, becomes a list of literal segments plus compiled holes, joined at run time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Caching.&lt;/strong&gt; Compiled delegates are kept in a process-wide cache keyed by the expression text. Two routes with the same condition share one compilation. The cache has no automatic eviction; &lt;code&gt;ExpressionResolver.ClearAllCaches()&lt;/code&gt; clears it by hand.&lt;/p&gt;

&lt;p&gt;I will not give a speed figure in this article. No clean measurement exists yet that I would publish, and a number from a busy development machine says nothing. What can be said precisely is what is compiled: everything. There is no interpreted mode to fall back to and no "compiled variant" to enable. Parsing happens when the route is built, and if the text does not parse, the route does not start: &lt;code&gt;.Filter("header.a &amp;gt;")&lt;/code&gt; throws &lt;code&gt;ExpressionCompilationException&lt;/code&gt; at &lt;code&gt;Start()&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bare text: a word is a word, arithmetic must be whole
&lt;/h3&gt;

&lt;p&gt;What should &lt;code&gt;application/json&lt;/code&gt; mean in an expression attribute? Apache Camel reads a text without operators as the text itself, and so does redb.Route: &lt;code&gt;hello&lt;/code&gt;, &lt;code&gt;plain text&lt;/code&gt; and &lt;code&gt;key=value&lt;/code&gt; are literals, and a name such as &lt;code&gt;header.a&lt;/code&gt; or &lt;code&gt;body&lt;/code&gt; is a lookup. A text that contains an arithmetic operator (&lt;code&gt;+ - * /&lt;/code&gt;) outside quotes is arithmetic, and it must be whole: it parses to its end, and every bare word in it must be a value. If it is not, the error names the place:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1 +                 → ends where a value is expected
header.a+b          → 'b' at position 10 is not a value
application/json    → 'application' at position 1 is not a value
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Write such text in quotes, &lt;code&gt;'application/json'&lt;/code&gt;. The same rule catches dates: a bare &lt;code&gt;2026-08-28&lt;/code&gt; is arithmetic and gives &lt;code&gt;1990&lt;/code&gt;, so a date is quoted or read from a header. The point of the rule is that a typo never turns into a plausible value. A half-parsed expression is an error at load, not a wrong number on a message.&lt;/p&gt;

&lt;h3&gt;
  
  
  Increments write into the exchange
&lt;/h3&gt;

&lt;p&gt;The language has &lt;code&gt;++&lt;/code&gt; and &lt;code&gt;--&lt;/code&gt;, prefix and postfix, on headers and properties. They are not decoration: they change the exchange.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Expression&lt;/th&gt;
&lt;th&gt;Returns&lt;/th&gt;
&lt;th&gt;Afterwards&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;header.a++&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;42&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;header.a = 43&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;++header.a&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;43&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;header.a = 43&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;header.a--&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;42&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;header.a = 41&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--header.a&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;41&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;header.a = 41&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;property.counter++&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;property.counter = 11&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;++property.counter&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;11&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;property.counter = 11&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Prefix returns the new value, postfix the old one, as in C#. An increment of a missing header or property starts from zero. A value that is there but is not a number is an error naming it, and the header is left as it was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;header.x++: the value 'abc' (String) is not a number.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The increment works inside a template too. In a route builder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SetProperty&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"attempt"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Constant&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;LoopWhile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"property.attempt &amp;lt; 3"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"attempt ${property.attempt++}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;To&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"direct://step"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;EndLoop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;LoopWhile&lt;/code&gt; repeats the body while the condition holds; the increment in the log template advances the counter, so the log prints &lt;code&gt;attempt 0&lt;/code&gt;, &lt;code&gt;attempt 1&lt;/code&gt;, &lt;code&gt;attempt 2&lt;/code&gt; and the body runs three times. (&lt;code&gt;Constant&lt;/code&gt; is a helper of &lt;code&gt;RouteBuilder&lt;/code&gt;; outside one, write &lt;code&gt;new ConstantExpression(0)&lt;/code&gt;.)&lt;/p&gt;

&lt;p&gt;Under the hood an increment compiles into a read, a computation and a write back into &lt;code&gt;In.Headers&lt;/code&gt; or &lt;code&gt;Properties&lt;/code&gt;. That is a plain read-modify-write, not an atomic operation. It is correct because one exchange is processed by one flow at a time; it is not a tool for counters shared between threads.&lt;/p&gt;

&lt;h3&gt;
  
  
  Literals do not depend on the server's locale
&lt;/h3&gt;

&lt;p&gt;Number literals are parsed with the invariant culture. &lt;code&gt;max(2.5, 1)&lt;/code&gt; means the same thing on an en-US build server and on a ru-RU production host, where the decimal separator is a comma. The same holds on the way out: a number or a date rendered into a template is &lt;code&gt;2.5&lt;/code&gt; and ISO 8601 on every machine. The boolean words in the truthiness rule (&lt;code&gt;true/false&lt;/code&gt;, &lt;code&gt;yes/no&lt;/code&gt;, &lt;code&gt;on/off&lt;/code&gt; and the rest) are English only, for the same reason: the locale of the person who wrote the route never changes what it means.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Typed templates
&lt;/h2&gt;

&lt;p&gt;The first part mentioned that a whole placeholder keeps its type. This deserves a closer look, because it removes a whole class of conversion code.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Template&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;${header.a}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;42&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;int&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;${header.a + 1}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;43&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;number&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;${header.a &amp;gt; 10}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;True&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;${header.price}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;2.5&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;number, rendered invariantly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;a=${header.a}, b=${header.b}, sum=${header.a + header.b}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;a=42, b=3, sum=45&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;[${header.missing}]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;[]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;SetHeader("n", Expr("${header.a}"))&lt;/code&gt; stores the &lt;code&gt;int&lt;/code&gt; 42, not the text "42". A Kafka key, an SQL parameter or a header read by the next step with &lt;code&gt;getHeader&amp;lt;int&amp;gt;&lt;/code&gt; receives a number, not a string that someone must parse again. As soon as there is text around a placeholder, the template is a string, which is what a template with text should be. A missing value renders as nothing, so &lt;code&gt;[${header.missing}]&lt;/code&gt; is &lt;code&gt;[]&lt;/code&gt; rather than &lt;code&gt;[null]&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  A format suffix
&lt;/h3&gt;

&lt;p&gt;When a number must be text of a fixed shape, a placeholder takes a standard .NET format after a colon:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Template&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;${header.price:F2}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;2.50&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;${header.a:D5}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;00042&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;${header.price * 4:F1}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10.0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;${value:F2}&lt;/code&gt; is &lt;code&gt;format(value, 'F2')&lt;/code&gt; with the invariant culture: one letter and up to two digits (&lt;code&gt;F2&lt;/code&gt;, &lt;code&gt;N0&lt;/code&gt;, &lt;code&gt;D8&lt;/code&gt;). The part before the colon is a path or a call, so a namespace such as &lt;code&gt;env:X&lt;/code&gt; is never mistaken for a format, and neither is the colon of a ternary. A custom format such as &lt;code&gt;yyyy-MM-dd&lt;/code&gt; goes through &lt;code&gt;format(...)&lt;/code&gt; or &lt;code&gt;dateformat(...)&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Where a placeholder ends: braces, quoting, escape
&lt;/h2&gt;

&lt;p&gt;A template looks simple until someone writes a brace inside a string literal. The rules are short and every one of them is executed by the guide's tests:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Template&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;${concat('a', '}', 'b')}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;a}b&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{${header.a}}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{42}&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;${}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;${}&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;${header.O'Brien}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;obrien&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;echo \${HOME} for ${header.s}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;echo ${HOME} for Hello World&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;text ${body&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;error: &lt;code&gt;unclosed '${' at position 6 of "text ${body": the placeholder has no closing '}'.&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A placeholder starts at &lt;code&gt;${&lt;/code&gt; and ends at the &lt;code&gt;}&lt;/code&gt; that balances it. A &lt;code&gt;}&lt;/code&gt; inside a quoted literal belongs to the literal, so &lt;code&gt;${concat('a', '}', 'b')}&lt;/code&gt; is one placeholder. A plain &lt;code&gt;{&lt;/code&gt; opens nothing, so the outer braces of &lt;code&gt;{${header.a}}&lt;/code&gt; stay text; that matters for JSON written as a template. An empty &lt;code&gt;${}&lt;/code&gt; is not a placeholder and stays as written. A quote inside a header name is part of the name, so &lt;code&gt;${header.O'Brien}&lt;/code&gt; reads the header &lt;code&gt;O'Brien&lt;/code&gt; without escaping. A quote that opens a string literal, on the other hand, must close:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;header.s == 'abc   → unterminated string literal starting at position 13 within the expression "header.s == 'abc".
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A literal &lt;code&gt;${&lt;/code&gt; is written &lt;code&gt;\${&lt;/code&gt;. It opens nothing and renders as &lt;code&gt;${&lt;/code&gt;, which is what a shell command or another template engine's syntax inside a route template needs.&lt;/p&gt;

&lt;p&gt;The last row is the important one. A &lt;code&gt;${&lt;/code&gt; that nothing closes is an error with its position, raised where the template is compiled: when the route is built in C#, when a route file is loaded, and earlier still by the package gate (section 9). It is never silently rendered as text.&lt;/p&gt;

&lt;p&gt;A placeholder may contain another placeholder in exactly one place: as an argument of a &lt;code&gt;bean:&lt;/code&gt; call (section 5). Everywhere else a &lt;code&gt;${&lt;/code&gt; inside an expression is an error naming its position.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Reading and comparing: the cases that usually hurt
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Names with dots and dashes
&lt;/h3&gt;

&lt;p&gt;Header names in integration are rarely C# identifiers: &lt;code&gt;Content-Type&lt;/code&gt;, &lt;code&gt;JMSCorrelationID&lt;/code&gt;, &lt;code&gt;x.request.id&lt;/code&gt;. The language resolves them with one rule: &lt;strong&gt;the literal name comes first.&lt;/strong&gt; &lt;code&gt;header.dotted.key&lt;/code&gt; is the header named &lt;code&gt;dotted.key&lt;/code&gt; if one exists, otherwise the member &lt;code&gt;key&lt;/code&gt; of the header &lt;code&gt;dotted&lt;/code&gt;. Inside a template the same rule keeps a dashed name readable: &lt;code&gt;${header.Content-Type}&lt;/code&gt; gives &lt;code&gt;text/xml&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In a bare expression the dash would be a minus, so &lt;code&gt;header.Content-Type&lt;/code&gt; there would be a subtraction. Instead of computing a meaningless difference, the engine stops with an error that tells you what to write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'header.Content-Type' at position 1 reads as a subtraction: a name with a dash is written ${header.Content-Type}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No quoted indexer syntax had to be invented for this.&lt;/p&gt;

&lt;h3&gt;
  
  
  Objects, collections, dictionaries
&lt;/h3&gt;

&lt;p&gt;An object reads the same wherever it lies: in a header, in a property or as the body. Members are found by name, case-insensitive, public fields included. A dictionary answers both &lt;code&gt;.key&lt;/code&gt; and &lt;code&gt;['key']&lt;/code&gt;. &lt;code&gt;header.user.Manager.Name&lt;/code&gt; gives &lt;code&gt;Bob&lt;/code&gt;, &lt;code&gt;header.list[1]&lt;/code&gt; gives &lt;code&gt;1&lt;/code&gt;, &lt;code&gt;property.cfg.enabled&lt;/code&gt; gives &lt;code&gt;True&lt;/code&gt;. Attachments of the In message have their own root: &lt;code&gt;attachments.size&lt;/code&gt; and &lt;code&gt;attachments[0].fileName&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Member access is null-safe by default: a member of a missing value is &lt;code&gt;null&lt;/code&gt;, not an exception, so there is no separate &lt;code&gt;?.&lt;/code&gt; to write. The exception of a failed exchange is a root like the others: bare &lt;code&gt;exception.Message&lt;/code&gt; reads the message, the same as &lt;code&gt;${exception.Message}&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Methods of the value itself
&lt;/h3&gt;

&lt;p&gt;A method of the object in a header or the body can be called in every position, conditions included:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Where&lt;/th&gt;
&lt;th&gt;Text&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;condition&lt;/td&gt;
&lt;td&gt;&lt;code&gt;header.s.length() &amp;gt; 10&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;True&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;template&lt;/td&gt;
&lt;td&gt;&lt;code&gt;${header.s.toUpper()}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;HELLO WORLD&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;value&lt;/td&gt;
&lt;td&gt;&lt;code&gt;header.list.Count&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;3&lt;/code&gt; (a property, no parentheses)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A method argument keeps its dots, so &lt;code&gt;header.list.contains(5.0)&lt;/code&gt; and &lt;code&gt;header.names.contains('a.b')&lt;/code&gt; pass the whole argument. A &lt;code&gt;null&lt;/code&gt; target gives &lt;code&gt;null&lt;/code&gt;. Which methods exist depends on the value, and the value is known only when the message arrives, so a failed call is reported on the message, as an &lt;code&gt;ExpressionEvaluationException&lt;/code&gt; that names the call and its position:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;header.o.Boom() at position 1 threw InvalidOperationException: boom
'Nope' is not a method of String at position 1 (in header.s.Nope()).
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A method that throws never turns into an empty value that flows on downstream.&lt;/p&gt;

&lt;h3&gt;
  
  
  Comparing: exact, ignoring case, in a range
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Condition&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;header.s == 'hello world'&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;False&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;header.s =~ 'hello world'&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;True&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;header.a =~ '42'&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;True&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;header.a range '1..42'&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;True&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;header.price range '2.5..3'&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;True&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;header.a not range '1..10'&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;True&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;header.missing range '1..10'&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;False&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;==&lt;/code&gt; on two strings is exact, case included. &lt;code&gt;=~&lt;/code&gt; is Apache Camel's equals-ignoring-case: two strings compare ignoring case, ordinally, with no culture involved; any other pair compares as &lt;code&gt;==&lt;/code&gt;. Numbers of different types are equal when their values are: &lt;code&gt;3 == 3.0&lt;/code&gt; and &lt;code&gt;3 == '3'&lt;/code&gt; are true, &lt;code&gt;3 == 5.0&lt;/code&gt; is false.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;range 'from..to'&lt;/code&gt; is true for a number within both ends, inclusive, as in Camel, and &lt;code&gt;not range&lt;/code&gt; is its opposite. The right side is a quoted literal read when the expression is compiled, so a malformed range (&lt;code&gt;'1-10'&lt;/code&gt;) or one whose start is above its end (&lt;code&gt;'10..1'&lt;/code&gt;) is an error at load and in the gate, not a filter that silently lets nothing through. A missing value is in no range. A text that is not a number is an error naming it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;header.s range '1..10': the value 'Hello World' (String) is not a number.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;range&lt;/code&gt; is an operator only after an operand; elsewhere it is a name, so &lt;code&gt;header.range&lt;/code&gt; reads the header called &lt;code&gt;range&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  JSON and XML in the body
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;jpath&lt;/code&gt; follows RFC 9535 through JsonPath.Net: &lt;code&gt;.name&lt;/code&gt;, &lt;code&gt;['name']&lt;/code&gt;, &lt;code&gt;[0]&lt;/code&gt;, slices, &lt;code&gt;[*]&lt;/code&gt;, &lt;code&gt;..&lt;/code&gt;, filters such as &lt;code&gt;[?(@.price &amp;lt; 10)]&lt;/code&gt; and the standard functions. &lt;code&gt;xpath&lt;/code&gt; reads XML. Inside &lt;code&gt;${...}&lt;/code&gt; a path may be written bare:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;${jpath($.order.id)}                                     → 7
id=${jpath($.order.id)} total=${jpath($.order.total)}    → id=7 total=150.5
${xpath(/order/id)}                                      → 7
${jsonpath:$.order.id}                                   → 7
${xpath:/order/id}                                       → 7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The last two lines are Apache Camel's spellings: &lt;code&gt;${jsonpath:path}&lt;/code&gt; and &lt;code&gt;${xpath:path}&lt;/code&gt; mean &lt;code&gt;jpath('path')&lt;/code&gt; and &lt;code&gt;xpath('path')&lt;/code&gt;. Each spelling fills its own &lt;code&gt;${...}&lt;/code&gt;, the path runs to the closing brace, and text may stand around the placeholder. A route copied from Camel keeps working.&lt;/p&gt;

&lt;p&gt;In a bare expression and in a condition the path must be quoted, &lt;code&gt;jpath('$.order.id')&lt;/code&gt;, because &lt;code&gt;$&lt;/code&gt; and &lt;code&gt;/&lt;/code&gt; are operators there. Unquoted, the expression does not compile, and again it fails when the route is built, not on a message.&lt;/p&gt;

&lt;h3&gt;
  
  
  File names: &lt;code&gt;${file:name}&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;A route that handles files usually needs the file's name: to archive it, to name a reply, to log it. Camel's file language is there: &lt;code&gt;${file:key}&lt;/code&gt; fills its own placeholder, the key runs to the closing brace, and it reads the headers a file consumer sets on the message. Text may stand around it, as the second row shows. With &lt;code&gt;redbFile.Name = "orders/a.xml"&lt;/code&gt; and &lt;code&gt;redbFile.NameOnly = "a"&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Template&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;${file:name}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;orders/a.xml&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;archive/${file:name.noext}.done&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;archive/a.done&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Key&lt;/th&gt;
&lt;th&gt;Header&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;name&lt;/code&gt;, &lt;code&gt;onlyname&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;redbFile.Name&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;name.noext&lt;/code&gt;, &lt;code&gt;onlyname.noext&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;redbFile.NameOnly&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;ext&lt;/code&gt;, &lt;code&gt;name.ext&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;redbFile.Extension&lt;/code&gt;, without the dot (&lt;code&gt;xml&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;parent&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;redbFile.Parent&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;path&lt;/code&gt;, &lt;code&gt;absolute.path&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;redbFile.AbsolutePath&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;relative.path&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;redbFile.RelativePath&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;length&lt;/code&gt;, &lt;code&gt;size&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;redbFile.Length&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;modified&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;redbFile.LastModified&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A message that did not come from a file has no such headers, and the key is empty. A key not in the table is an error when the route is built, and the error lists the keys. The file consumers' own options (&lt;code&gt;moveTo&lt;/code&gt;, &lt;code&gt;preMove&lt;/code&gt;, &lt;code&gt;moveFailed&lt;/code&gt;, &lt;code&gt;doneFileName&lt;/code&gt;, &lt;code&gt;idempotentKey&lt;/code&gt;, and S3's &lt;code&gt;doneFileName&lt;/code&gt;) take the same keys through the same table and give the same values, read from the file being handled. There a key matches ignoring case, as these options always did; in a template it matches exactly, as in Camel.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Reaching outside the message: &lt;code&gt;bean:&lt;/code&gt;, &lt;code&gt;ref:&lt;/code&gt;, &lt;code&gt;env:&lt;/code&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;bean:&lt;/code&gt;, calling your own code
&lt;/h3&gt;

&lt;p&gt;Sooner or later a route needs a decision that the language should not express: a loyalty check, a price calculation, a rule that lives in a service. The language calls a method of an object registered in the route context, in any position: a condition, a value or a template.&lt;/p&gt;

&lt;p&gt;The examples use a registry with two beans, &lt;code&gt;pricing&lt;/code&gt; and &lt;code&gt;pricing-rules&lt;/code&gt;, each with &lt;code&gt;Gross(int qty, double price)&lt;/code&gt;, &lt;code&gt;IsGold(string name)&lt;/code&gt;, &lt;code&gt;Badge(string name, int points)&lt;/code&gt; and &lt;code&gt;Touch(string)&lt;/code&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Expression&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;bean:pricing.Gross(header.b, header.price)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;7.5&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;${bean:pricing.Gross(${header.b}, ${header.price})}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;7.5&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;bean:pricing-rules.Badge(header.user.Name, 7)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Ann:7&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;bean:pricing.Gross(header.b, 2) - 1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;5&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;bean:pricing.Touch('x')&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;null&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Condition&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;bean:pricing.IsGold(header.user.Name)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;True&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;header.flag &amp;amp;&amp;amp; bean:pricing.IsGold('Bob')&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;False&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Template&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;total ${bean:pricing.Gross(header.b, 2)} EUR&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;total 6 EUR&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A bean call is a full participant of the expression: its result can be compared, combined with &lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt;, used in arithmetic. In a route file it looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;filter&lt;/span&gt; &lt;span class="na"&gt;expr&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"bean:loyalty.IsGold(header.customer)"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;to&lt;/span&gt; &lt;span class="na"&gt;uri&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"direct://gold"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/filter&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The rules, all of them visible in the tables above:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The name&lt;/strong&gt; is the registry name without &lt;code&gt;#&lt;/code&gt; and may contain dashes (&lt;code&gt;pricing-rules&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The method&lt;/strong&gt; is required. &lt;code&gt;bean:pricing&lt;/code&gt; alone is an error. &lt;code&gt;bean:pricing.Method&lt;/code&gt; without parentheses calls it with no arguments, and a dash after it is a minus: &lt;code&gt;bean:svc.Count-1&lt;/code&gt; calls &lt;code&gt;Count&lt;/code&gt; and subtracts one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Arguments&lt;/strong&gt; are expressions of the language. Inside a &lt;code&gt;${bean:...}&lt;/code&gt; placeholder an argument may be wrapped in &lt;code&gt;${...}&lt;/code&gt; and means the same as written bare; this is the Camel form, and it works. In a bare expression write the arguments bare. A &lt;code&gt;${&lt;/code&gt; there makes the whole text a template (it renders instead of calling), and the gate warns about exactly this mistake.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Binding&lt;/strong&gt; goes by method name (any case) and number of arguments. A parameter of type &lt;code&gt;IExchange&lt;/code&gt;, &lt;code&gt;IMessage&lt;/code&gt; or &lt;code&gt;CancellationToken&lt;/code&gt; is filled in by the binding and does not count. Each argument converts to its parameter's type.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The result keeps its type.&lt;/strong&gt; A &lt;code&gt;void&lt;/code&gt; method gives &lt;code&gt;null&lt;/code&gt;, which reads as false or empty, as in Apache Camel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resolution is lazy and per context.&lt;/strong&gt; The bean is looked up on the call's first evaluation in a route context and the bound method is kept for that context. The compiled delegate is shared through the text cache, but each context resolves its own bean, so two contexts with different &lt;code&gt;pricing&lt;/code&gt; objects never see each other's. A missing bean or method is an error naming the call.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The colon touches both sides.&lt;/strong&gt; &lt;code&gt;bean:&lt;/code&gt; is a call only when the colon touches &lt;code&gt;bean&lt;/code&gt; and the name. In a ternary whose branch is a variable named &lt;code&gt;bean&lt;/code&gt;, keep the spaces: &lt;code&gt;flag ? bean : other&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Synchronous only, and why
&lt;/h3&gt;

&lt;p&gt;An expression is evaluated synchronously: a template is rendered into a string right now, a value is computed right now. A method that returns &lt;code&gt;Task&lt;/code&gt;, &lt;code&gt;Task&amp;lt;T&amp;gt;&lt;/code&gt;, &lt;code&gt;ValueTask&lt;/code&gt; or &lt;code&gt;ValueTask&amp;lt;T&amp;gt;&lt;/code&gt; is therefore refused, with advice to call it as a step instead: &lt;code&gt;&amp;lt;bean ref="#name" method="..."/&amp;gt;&lt;/code&gt; in markup or &lt;code&gt;.Bean("#name", "...")&lt;/code&gt; in C#. The same rule holds in Apache Camel's Simple language. Blocking on a task inside an expression would hide a thread stall in a place nobody looks for one, so the language does not offer it.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;Method()&lt;/code&gt; in C#, and where &lt;code&gt;Task&amp;lt;bool&amp;gt;&lt;/code&gt; is awaited
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;Method(reference, spec)&lt;/code&gt; is the typed form of the same call, the counterpart of Camel's &lt;code&gt;method()&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="nc"&gt;From&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"direct://orders"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Method&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"#loyalty"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"IsGold(${header.customer})"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;      &lt;span class="c1"&gt;// a condition&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SetBody&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Method&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"#pricing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Gross(${header.qty}, 2.5)"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;// a value, its type kept&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;EndFilter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Validate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Method&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"#rules"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"IsAllowed(${header.customer})"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"not allowed"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is one place where asynchronous code is welcome: a condition. Conditions in redb.Route are predicates that the engine awaits (&lt;code&gt;MatchesAsync&lt;/code&gt;), so in &lt;code&gt;Filter&lt;/code&gt;, &lt;code&gt;When&lt;/code&gt; and &lt;code&gt;Validate&lt;/code&gt; a &lt;code&gt;Method()&lt;/code&gt; whose target returns &lt;code&gt;Task&amp;lt;bool&amp;gt;&lt;/code&gt; is awaited properly. In a value position the call is synchronous, as the &lt;code&gt;bean:&lt;/code&gt; function is. &lt;code&gt;Validate&lt;/code&gt; also accepts any expression and reads it as a condition, the way &lt;code&gt;Filter&lt;/code&gt; does: &lt;code&gt;Validate(Expr("header.a &amp;gt; 0"))&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;ref:&lt;/code&gt;, the registry object itself
&lt;/h3&gt;

&lt;p&gt;Sometimes a route needs the registered object, not a call on it: a limit, a settings object, a value to pass to another method. &lt;code&gt;ref:name&lt;/code&gt; is the object registered under &lt;code&gt;name&lt;/code&gt;, as Camel's &lt;code&gt;${ref:name}&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Expression&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ref:limits.max&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;100&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ref:limits.max - header.b&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;97&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;${ref:limits.max}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;100&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;header.a &amp;lt; ref:limits.max&lt;/code&gt; (condition)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;True&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;max ${ref:limits.max}&lt;/code&gt; (template)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;max 100&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The name is the whole run of letters, digits, &lt;code&gt;_&lt;/code&gt;, &lt;code&gt;.&lt;/code&gt; and &lt;code&gt;-&lt;/code&gt; after the colon, so &lt;code&gt;ref:limits.max&lt;/code&gt; is the object registered as &lt;code&gt;limits.max&lt;/code&gt;, not a member of &lt;code&gt;limits&lt;/code&gt;. Put a space before a minus: &lt;code&gt;ref:limit-1&lt;/code&gt; is the name &lt;code&gt;limit-1&lt;/code&gt;, &lt;code&gt;ref:limit - 1&lt;/code&gt; subtracts. &lt;code&gt;ref:&lt;/code&gt; reads nothing from the object itself. A whole placeholder &lt;code&gt;${ref:name}&lt;/code&gt; keeps the object, so a header set from it holds the instance; with text around it the template writes its &lt;code&gt;ToString()&lt;/code&gt;. To use a member, pass the object to a method: &lt;code&gt;bean:fmt.Describe(ref:chat.settings)&lt;/code&gt;. A missing name is an error naming it, the lookup happens once per route context, and the colon needs to touch both sides, as with &lt;code&gt;bean:&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;env:&lt;/code&gt;, the process environment
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;env:NAME&lt;/code&gt; is the OS environment variable &lt;code&gt;NAME&lt;/code&gt;, as Camel's &lt;code&gt;${env:NAME}&lt;/code&gt;: &lt;code&gt;${env:BILLING_TOKEN}&lt;/code&gt; in a template, &lt;code&gt;env:REGION == 'eu'&lt;/code&gt; in a condition. A variable that is not set is &lt;code&gt;null&lt;/code&gt; and renders empty. It is read on every evaluation.&lt;/p&gt;

&lt;p&gt;For a value that may come from configuration or from the environment there is a second mechanism that is not part of the expression language: &lt;code&gt;{{BILLING_TOKEN}}&lt;/code&gt; and &lt;code&gt;{{key:default}}&lt;/code&gt; configuration placeholders, resolved before the route runs in endpoint URIs, &lt;code&gt;enabled=&lt;/code&gt;, bean values and &lt;code&gt;value=&lt;/code&gt; of &lt;code&gt;&amp;lt;setHeader&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;setProperty&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;setBody&amp;gt;&lt;/code&gt;. They read the host's &lt;code&gt;IConfiguration&lt;/code&gt; first (environment, &lt;code&gt;appsettings.json&lt;/code&gt;, secrets, in the host's order), then the context properties, and the OS environment only when the context has no &lt;code&gt;IConfiguration&lt;/code&gt;. A key with no value and no default is an error naming the key.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. The comparison trap, and who catches it
&lt;/h2&gt;

&lt;p&gt;One mistake deserves its own section because every Camel user makes it on day one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"${header.kind} == 'order'"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;// always true&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"header.kind == 'order'"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;      &lt;span class="c1"&gt;// what was meant&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first line is a template. It renders to text such as &lt;code&gt;refund == 'order'&lt;/code&gt;, the text is not empty, and a non-empty string is true. In Camel's Simple this form is the normal way to write a predicate; in redb.Route a string with &lt;code&gt;${...}&lt;/code&gt; is a string, and a comparison is written whole, either bare or entirely inside the braces. The language is consistent here, but consistency does not help someone who types from muscle memory. So the package gate warns about it, at the attribute, for &lt;code&gt;==&lt;/code&gt; and for the Camel operators &lt;code&gt;=~&lt;/code&gt; and &lt;code&gt;range&lt;/code&gt; alike:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;warning: &amp;lt;file&amp;gt;(line,col): expr="${header.kind} == 'order'" compares OUTSIDE ${…}: a condition holding a placeholder is rendered to text first, and non-empty text is true whatever it says. Write the comparison without the braces (header.kind == 'order') or entirely inside them.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It also warns about the related forms: a &lt;code&gt;bean:&lt;/code&gt; call with &lt;code&gt;${...}&lt;/code&gt; arguments outside a placeholder, and a &lt;code&gt;ref:&lt;/code&gt; name outside &lt;code&gt;${...}&lt;/code&gt; in a text that has placeholders (section 9).&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Templates are data: the sandbox
&lt;/h2&gt;

&lt;p&gt;redb.Route has a second kind of template: payload templates of the &lt;code&gt;redb.Route.Templates&lt;/code&gt; package, &lt;code&gt;{{ ... }}&lt;/code&gt; documents that render a message body. Their text often comes from configuration, a database or a partner, not from a developer. Data must not run code.&lt;/p&gt;

&lt;p&gt;So a payload template renders inside a sandbox (&lt;code&gt;ExpressionSandbox&lt;/code&gt;). Inside it objects expose their properties and fields, built-in functions work, and the built-in string helpers work. &lt;code&gt;expr('x')&lt;/code&gt; evaluates &lt;code&gt;x&lt;/code&gt; exactly as &lt;code&gt;${x}&lt;/code&gt; would in a route template, but under the template's sandbox. A method call that would run code is refused, and so are the ways out of the message: &lt;code&gt;bean:&lt;/code&gt;, &lt;code&gt;ref:&lt;/code&gt; and &lt;code&gt;env:&lt;/code&gt;. A run against the current code, with a body object whose method &lt;code&gt;Pwn()&lt;/code&gt; sets a flag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{{ body.Name }}                 → ann
{{ expr('upper(body.Name)') }}  → ANN
{{ expr('body.Pwn()') }}        → ExpressionSandboxViolationException:
                                  Method 'Pwn' on Probe cannot be called here: the expression runs in a sandbox
                                  (a template argument or expr()), where objects expose their members but never code.
                                  (the flag stayed false: the method did not run)
{{ expr('bean:rules.IsGold(body.Name)') }}  → error: Method 'IsGold' on TemplateGoldRules cannot be called here: ...
{{ expr('ref:rules') }}                     → error: 'ref:rules' cannot be read here: the expression runs in a sandbox
                                              (a template argument or expr()), which reads the message and its values,
                                              not the registry or the process environment.
{{ expr('env:PATH') }}                      → error: 'env:PATH' cannot be read here: ... (the same sentence)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The sandbox covers the whole render: the template's arguments and every &lt;code&gt;expr(...)&lt;/code&gt; in it. A payload template can therefore neither call your services nor read the process environment, whoever wrote it. Route expressions written by a developer in C# or in a route file are code and are not sandboxed; payload templates are data and are.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Your own roots: prefix resolvers
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;header.&lt;/code&gt;, &lt;code&gt;property.&lt;/code&gt;, &lt;code&gt;body&lt;/code&gt; and &lt;code&gt;exception.&lt;/code&gt; are the built-in roots. A module can add its own, so that a route reads domain data as naturally as a header:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;RegisterPrefixResolver&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"order."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exchange&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Read&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exchange&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A run with a resolver that returns &lt;code&gt;150.5m&lt;/code&gt; for &lt;code&gt;total&lt;/code&gt; and &lt;code&gt;true&lt;/code&gt; for &lt;code&gt;vip&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Where&lt;/th&gt;
&lt;th&gt;Text&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;whole placeholder&lt;/td&gt;
&lt;td&gt;&lt;code&gt;${order.total}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;150.5&lt;/code&gt;, a &lt;code&gt;decimal&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;mixed template&lt;/td&gt;
&lt;td&gt;&lt;code&gt;total=${order.total}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;total=150.5&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;condition&lt;/td&gt;
&lt;td&gt;&lt;code&gt;order.vip&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;True&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;condition&lt;/td&gt;
&lt;td&gt;&lt;code&gt;order.total &amp;gt; 100&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;True&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A resolver works in every position, and a whole placeholder keeps the type it returns. The order of lookup is fixed: built-in roots first, then the resolvers of the exchange's route context, then the process-wide ones (&lt;code&gt;ExpressionResolver.RegisterPrefixResolver&lt;/code&gt;). The run confirms it: a resolver registered for &lt;code&gt;header.&lt;/code&gt; does not shadow the real header. A resolver registered on a route context lives and dies with that context, so a module that is unloaded leaves nothing behind in the process. Registration is done in code, typically in the module's context initialisation; there is no markup element for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. The gate: errors with line and column before deployment
&lt;/h2&gt;

&lt;p&gt;Compiling at &lt;code&gt;Start()&lt;/code&gt; already means a broken expression never meets live traffic. A route file can be checked earlier still. The package gate (&lt;code&gt;redb-route-xml check&lt;/code&gt;, and &lt;code&gt;pack&lt;/code&gt;, which runs the same checks and builds only a clean package) compiles every expression of every route file, a bare one and each &lt;code&gt;${...}&lt;/code&gt;, exactly as the engine compiles it. An expression the engine would refuse is an error at its attribute, with line and column, in the engine's words. For every &lt;code&gt;bean:&lt;/code&gt; call and &lt;code&gt;ref:&lt;/code&gt; name it checks that a &lt;code&gt;&amp;lt;bean&amp;gt;&lt;/code&gt; of the package declares it, and with &lt;code&gt;--bin&lt;/code&gt; it loads the module's assemblies and checks every &lt;code&gt;bean:&lt;/code&gt; call against the declared bean's type.&lt;/p&gt;

&lt;p&gt;Here is real output of the check on test packages (the project path is shortened):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;error: routes/main.route.xml(5,14): expr= unclosed '${' at position 7 of "total ${header.amount": the placeholder has no closing '}'.
error: routes/main.route.xml(6,25): expr= a bean: call names its method: bean:rules.Method(...) (position 1 within the expression).
warning: routes/main.route.xml: '#pricing' is not declared by any &amp;lt;bean&amp;gt; of this package — either module code registers it at startup (fine), or it is a dangling reference.
error: routes/main.route.xml(8,13): expr= bean: '#rules' has no public method 'Badge' taking 1 argument(s) (IExchange, IMessage and CancellationToken parameters are supplied by the binding and do not count).
error: routes/main.route.xml(9,13): expr= bean:rules.CheckAsync returns Task`1: a bean: call in an expression is synchronous. Call an asynchronous method as a step: &amp;lt;bean ref="#rules" method="CheckAsync(...)"/&amp;gt; or .Bean("#rules", "CheckAsync(...)").
warning: routes/main.route.xml(10,13): expr= holds a bean: call outside ${...} with ${...} arguments: the text is a template and renders instead of calling (in a condition it is always true). Write the arguments bare, bean:svc.Check(header.x), or the whole call as one placeholder, ${bean:svc.Check(${header.x})}.
warning: &amp;lt;file&amp;gt;(line,col): expr= holds a ref: name outside ${...} in a text with ${...}: the text is a template and renders ref:name as text instead of reading the object (in a condition it is always true). Write the whole expression bare, ref:limit &amp;gt; header.x, or as one placeholder, ${ref:limit &amp;gt; header.x}.
error: &amp;lt;file&amp;gt;(line,col): expr= Error compiling expression 'header.b == 3 garbage' using AST: unexpected 'garbage' at position 15 within the expression: the expression ends before it.
warning: &amp;lt;file&amp;gt;(line,col): expr= "header.b 3" reads as the text itself, not as an expression: '3' at position 10 does not continue it; in a condition the text is always true.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every message says what is wrong and how to write it instead. Note the difference between errors and warnings. A bean that no &lt;code&gt;&amp;lt;bean&amp;gt;&lt;/code&gt; of the package declares is only a warning, because module code may legitimately register it at startup; the gate cannot know, so it says both possibilities. A method with the wrong number of arguments, or one that returns a task, is an error, because no runtime situation makes it right. Text after a complete expression is an error, here and when the route is built. &lt;code&gt;header.b 3&lt;/code&gt; is only a warning: by the rule for bare text it is a valid literal, but it starts like a lookup, and the gate says what it will actually be.&lt;/p&gt;

&lt;p&gt;The editor side, to be precise about it: the redb Route XML extension for VS Code validates the markup of a route file against its schema while you type (elements, attributes, required values). Expression attributes are plain strings to the schema, so expression errors come from the gate and from route loading, not from underlines in the editor. The next release of the extension adds completion of bean names after &lt;code&gt;bean:&lt;/code&gt; and &lt;code&gt;${bean:&lt;/code&gt;, taken from the file's own &lt;code&gt;&amp;lt;bean&amp;gt;&lt;/code&gt; declarations and from the module's &lt;code&gt;context.xml&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. Where the language is stronger, and why
&lt;/h2&gt;

&lt;p&gt;Each point below rests on something shown above.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Compiled is the only mode.&lt;/strong&gt; There is no interpreter path to fall into and no separate compiled dialect with its own restrictions. Any valid expression, including nested functions and registry calls, becomes IL when the route is built.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Errors come before traffic, twice.&lt;/strong&gt; The gate reports a broken expression at the attribute with line and column before a package is built. If something slips past, &lt;code&gt;Start()&lt;/code&gt; throws before the first message. A broken condition never becomes a quiet "no".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A typo is an error, not a value.&lt;/strong&gt; Half-parsed arithmetic, text left after a complete expression, an unclosed quote, a dashed name written bare, a malformed range, an increment of a non-number, and a method that throws or does not exist all stop with a message that names the place. None of them quietly produces a plausible result.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bean calls are checked against real types.&lt;/strong&gt; With &lt;code&gt;--bin&lt;/code&gt; the gate verifies that the method exists, takes that many arguments, and is synchronous. A typo in a method name is a build error, not a production incident.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Values keep their types.&lt;/strong&gt; A whole placeholder returns an &lt;code&gt;int&lt;/code&gt;, a &lt;code&gt;bool&lt;/code&gt;, a &lt;code&gt;decimal&lt;/code&gt;, a registry object, whatever the expression or the resolver produced. Downstream steps receive data, not text to parse again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The meaning does not depend on the machine.&lt;/strong&gt; Literals are parsed and values rendered with the invariant culture, format suffixes included; &lt;code&gt;=~&lt;/code&gt; compares ordinally; the truthiness words are English only.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Guards work as in C#.&lt;/strong&gt; &lt;code&gt;AND&lt;/code&gt;, &lt;code&gt;OR&lt;/code&gt; and &lt;code&gt;??&lt;/code&gt; short-circuit, so a check on the left protects a call on the right.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One truthiness rule.&lt;/strong&gt; A condition, an operand of &lt;code&gt;AND&lt;/code&gt;, and &lt;code&gt;logical()&lt;/code&gt; read a value the same way, everywhere in the library.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Increments change the exchange.&lt;/strong&gt; &lt;code&gt;property.attempt++&lt;/code&gt; is a counter, not a computed value that someone has to store back.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data never runs code.&lt;/strong&gt; Payload templates render in a sandbox where method calls, registry access and the environment are refused with a clear exception.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Extensions are scoped.&lt;/strong&gt; A prefix resolver registered on a route context leaves with that context.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The documentation cannot drift.&lt;/strong&gt; Every marked example in the guide runs on every test run. Changes to how templates are scanned were checked against a snapshot of the 956 distinct templates found in the redb.Route tree, and every changed line was reviewed before the change landed.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  11. Compared with Apache Camel's Simple
&lt;/h2&gt;

&lt;p&gt;The resemblance to Simple is deliberate, and someone coming from Camel will recognise almost every form. The differences, form by form:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Camel Simple&lt;/th&gt;
&lt;th&gt;redb.Route&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;${header.x}&lt;/code&gt;, &lt;code&gt;${exchangeProperty.x}&lt;/code&gt;, &lt;code&gt;${body}&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;${header.x}&lt;/code&gt;, &lt;code&gt;${property.x}&lt;/code&gt;, &lt;code&gt;${body}&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;${header.x} == 'a'&lt;/code&gt; as a predicate&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;header.x == 'a'&lt;/code&gt;; &lt;code&gt;${...}&lt;/code&gt; around an operand renders text first&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;${bean:name.method(${body})}&lt;/code&gt;, &lt;code&gt;${bean:name?method=m}&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;${bean:name.method(${body})}&lt;/code&gt; or bare &lt;code&gt;bean:name.method(body)&lt;/code&gt;; the &lt;code&gt;?method=&lt;/code&gt; form belongs to the &lt;code&gt;bean:&lt;/code&gt; endpoint URI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;method(ref, "name")&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Method("#ref", "name(args)")&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;${ref:x}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;${ref:x}&lt;/code&gt; or &lt;code&gt;ref:x&lt;/code&gt;; the whole run is the name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;${header.x} =~ 'abc'&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;header.x =~ 'abc'&lt;/code&gt;: two strings ignore case, any other pair is &lt;code&gt;==&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;${header.n} range '100..199'&lt;/code&gt;, &lt;code&gt;not range&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;header.n range '100..199'&lt;/code&gt;, &lt;code&gt;not range&lt;/code&gt;; the literal is checked at load&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;${env:X}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;${env:X}&lt;/code&gt; or &lt;code&gt;env:X&lt;/code&gt;; &lt;code&gt;{{X}}&lt;/code&gt; reads configuration first&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;${jsonpath:$.x}&lt;/code&gt;, &lt;code&gt;${xpath:/x}&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;the same, or &lt;code&gt;jpath('$.x')&lt;/code&gt; / &lt;code&gt;xpath('/x')&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;${file:name}&lt;/code&gt;, &lt;code&gt;${file:name.noext}&lt;/code&gt;, &lt;code&gt;${file:size}&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;the same, over the &lt;code&gt;redbFile.*&lt;/code&gt; headers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;${date:now:yyyyMMdd}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;dateformat(now(), 'yyyyMMdd')&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;escaping &lt;code&gt;\${&lt;/code&gt; and &lt;code&gt;$${&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;\${&lt;/code&gt;; &lt;code&gt;$${&lt;/code&gt; is a dollar sign followed by a placeholder&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;What Simple has and redb.Route does not have today, stated plainly: the &lt;code&gt;?.&lt;/code&gt; operator, which has nothing to do here because member access is null-safe by default, and the &lt;code&gt;${date:...}&lt;/code&gt; spelling, whose work &lt;code&gt;dateformat(now(), ...)&lt;/code&gt; does.&lt;/p&gt;

&lt;h2&gt;
  
  
  12. Known limits
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What&lt;/th&gt;
&lt;th&gt;Today&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;jpath($.x)&lt;/code&gt; / &lt;code&gt;xpath(/x)&lt;/code&gt; bare and unquoted&lt;/td&gt;
&lt;td&gt;does not compile; quote the path or write it inside &lt;code&gt;${...}&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;round(2.5)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;2&lt;/code&gt;: rounding half to even, as .NET does&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;a backslash meant as text right before a placeholder (&lt;code&gt;\\${header.x}&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;has no spelling&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;a method call on a value that throws or does not exist&lt;/td&gt;
&lt;td&gt;an error on the message, not at build: the value's type is known only then&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The list is short because the mistakes that usually pass silently (trailing text, a bare dashed name, a non-numeric increment, a throwing method) are errors with a position here. The rows above are what remains.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to take away
&lt;/h2&gt;

&lt;p&gt;The first part argued that expression strings are worth having at all. This one shows what stands behind them. A string is parsed by a real tokenizer and parser into a LINQ expression tree and compiled once, with &lt;code&gt;AND&lt;/code&gt;, &lt;code&gt;OR&lt;/code&gt; and &lt;code&gt;??&lt;/code&gt; short-circuiting as in C#. A half-written expression is an error with a position, not a value. A placeholder ends exactly where its braces balance, and &lt;code&gt;\${&lt;/code&gt; writes one literally. A bean call binds against real types and is checked before deployment, and &lt;code&gt;ref:&lt;/code&gt; and &lt;code&gt;env:&lt;/code&gt; reach the registry and the environment the way Camel users expect. Data templates cannot run code or read the environment. A module can add its own roots without leaving traces in the process. Every result in the guide is executed by a test.&lt;/p&gt;

&lt;p&gt;The guide itself, with every table and rule from this article, is &lt;a href="https://github.com/redbase-app/redb-route/blob/main/EXPRESSIONS.md" rel="noopener noreferrer"&gt;EXPRESSIONS.md&lt;/a&gt; in the repository. The language ships inside &lt;a href="https://www.nuget.org/packages/redb.Route/" rel="noopener noreferrer"&gt;redb.Route on NuGet&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;If this was useful — a ⭐ on &lt;a href="https://github.com/redbase-app" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; helps others find it.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;More of my writing: &lt;a href="https://redbase.app/articles" rel="noopener noreferrer"&gt;redbase.app/articles&lt;/a&gt;, and on &lt;a href="https://dev.to/rinat_kozin"&gt;dev.to&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>eip</category>
      <category>camel</category>
      <category>integration</category>
    </item>
    <item>
      <title>redb Route XML for VS Code: projects from templates, markup, a route graph and Mermaid diagrams</title>
      <dc:creator>rinat kozin</dc:creator>
      <pubDate>Thu, 05 Nov 2026 00:01:16 +0000</pubDate>
      <link>https://dev.to/rinat_kozin/redb-route-xml-for-vs-code-projects-from-templates-markup-a-route-graph-and-mermaid-diagrams-hj7</link>
      <guid>https://dev.to/rinat_kozin/redb-route-xml-for-vs-code-projects-from-templates-markup-a-route-graph-and-mermaid-diagrams-hj7</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkfdlsk3mslkuljiq4hhj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkfdlsk3mslkuljiq4hhj.png" alt="redb.Route VSCode" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The VS Code extension on the Marketplace: a project from a template, schema completion, bean hints, a route tree and graph, Mermaid, the way to a Tsak worker.&lt;/p&gt;

&lt;p&gt;An integration route in redb.Route can be written in C# or in markup: a &lt;code&gt;.route.xml&lt;/code&gt; file goes into a package, the package into the folder of a Tsak worker, and the route starts working. The format needs no editor; it is plain XML that the service loads as it is. But writing it by hand from memory is awkward: which options a connector has, what an element is called, which bean to refer to, where a message goes when no branch matches.&lt;/p&gt;

&lt;p&gt;That is what the &lt;strong&gt;redb Route XML&lt;/strong&gt; extension for VS Code is for. Since late October it has been on the Visual Studio Marketplace, current version 0.2.25. Below is the whole path with it: from an empty folder and a project from a template, through markup, completion and the graph, to a diagram for the docs and a module on a worker.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you get
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A start in a minute.&lt;/strong&gt; A working module with routes, checks and a stand is created from a page, without knowing the &lt;code&gt;dotnet new&lt;/code&gt; commands or hunting for the right template package.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Errors show while you type.&lt;/strong&gt; A wrong element, an option of the wrong connector or the wrong side of an endpoint is underlined at once, not in the worker's log after deployment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No connector options to memorize.&lt;/strong&gt; Kafka alone has more than forty options; the editor offers them with their types and allowed values, exactly what the service of the current release accepts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A route others can read too.&lt;/strong&gt; The graph shows the transaction boundary, the branches and the path of a message that matched no condition. Walking a flow through with an analyst, a tester or support is easier with it than with the text.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clean changes in git.&lt;/strong&gt; The graph changes only the place it edits, so a change made with the mouse looks like an ordinary short diff in review.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docs that do not drift from the code.&lt;/strong&gt; The Mermaid diagram is built from the same route that runs on the worker and is refreshed with one command.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No cost.&lt;/strong&gt; The extension is licensed under Apache 2.0, and the schema, tree and graph work offline.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What the extension does
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;New Project:&lt;/strong&gt; a page that creates a project from the redb templates and installs the template packages itself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Schema:&lt;/strong&gt; completion of elements, attributes and the options of every connector, validation as you type.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Skeletons:&lt;/strong&gt; a route, a choice and an error-handling block in one insert.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bean references:&lt;/strong&gt; a list of declared objects on &lt;code&gt;#&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Route tree:&lt;/strong&gt; every route in the workspace with a jump to its line.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Graph:&lt;/strong&gt; the route as a diagram you edit with the mouse that stays text.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mermaid:&lt;/strong&gt; a route diagram for a README or a wiki.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;In the &lt;strong&gt;Extensions&lt;/strong&gt; view search for &lt;code&gt;redb Route XML&lt;/code&gt; and click &lt;strong&gt;Install&lt;/strong&gt;, or from a terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;code --install-extension redb.redb-route-xml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F710pr3kg2mtmh5fyj1c3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F710pr3kg2mtmh5fyj1c3.png" alt="redb Route XML in the extension list" width="799" height="127"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;VS Code installs &lt;a href="https://marketplace.visualstudio.com/items?itemName=redhat.vscode-xml" rel="noopener noreferrer"&gt;Red Hat XML&lt;/a&gt; along with it: that extension does the completion and validation, and ours hands it the schema. VS Code 1.85 or newer is required.&lt;/p&gt;

&lt;p&gt;For a machine without Marketplace access, and for VSCodium and Cursor, the same &lt;code&gt;redb-route-xml-0.2.25.vsix&lt;/code&gt; is attached to the &lt;a href="https://github.com/redbase-app/redb-route/releases" rel="noopener noreferrer"&gt;redb-route releases on GitHub&lt;/a&gt;: &lt;strong&gt;Extensions&lt;/strong&gt;, the &lt;code&gt;...&lt;/code&gt; menu, &lt;strong&gt;Install from VSIX&lt;/strong&gt;. Offline, install the Red Hat XML &lt;code&gt;.vsix&lt;/code&gt; first the same way.&lt;/p&gt;

&lt;h2&gt;
  
  
  A new project without the command line
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;redb: New Project&lt;/strong&gt; from the Command Palette opens a page that creates a project from the redb templates through &lt;code&gt;dotnet new&lt;/code&gt;. The top shows what is on the machine: the .NET SDKs and two template packages, &lt;code&gt;redb.Templates&lt;/code&gt; and &lt;code&gt;redb.Tsak.Templates&lt;/code&gt;. A missing package gets an &lt;strong&gt;Install&lt;/strong&gt; button:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd9f5e2m60zsh5bjtmxod.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd9f5e2m60zsh5bjtmxod.png" alt="Template packages not installed" width="800" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When nuget.org has a newer version of a package, the button turns into &lt;strong&gt;Update&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Every template is a card, in three groups.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;XML route modules&lt;/strong&gt;, twenty &lt;code&gt;redb-route-*&lt;/code&gt; templates. Each creates a Tsak module with routes in markup and the same scenario in C# next to it, in &lt;code&gt;routes/*.cs&lt;/code&gt;: handy for comparing two ways of writing one flow. Among them: files (a local folder, FTP, SFTP), a REST API, an SQL outbox and batch inserts, redb objects, Kafka, RabbitMQ, AMQP 1.0, MQTT, S3, LDAP, mail, AS2 and AS4, a Quartz schedule, an XSD check with XSLT, scatter-gather and a set of integration patterns without a broker.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh2z36te1p0596e4y8fou.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh2z36te1p0596e4y8fou.png" alt="Template cards and the form" width="800" height="587"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tsak hosts:&lt;/strong&gt; a worker that loads modules from its folder, reloads them on the fly, and offers a management API and a scheduler.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Applications&lt;/strong&gt; on redb: a console app, Blazor and Razor Pages sites, Blazor WebAssembly with a redb.Route REST API, a Blazor BFF, an integration worker, an application on redb.Identity, an LLM chat.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F39pwhnmmqwc8hvi1sd4t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F39pwhnmmqwc8hvi1sd4t.png" alt="Application templates" width="800" height="497"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the right is the form with the chosen template's parameters: project name, target framework, database, state store, folder. A framework with no SDK on this machine is marked, and a folder that already holds files is refused.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create&lt;/strong&gt; runs &lt;code&gt;dotnet new&lt;/code&gt;, and when the project carries a local tool manifest, &lt;code&gt;dotnet tool restore&lt;/code&gt; as well. The output goes to the page and to the &lt;strong&gt;redb Route&lt;/strong&gt; output channel, and a running step can be cancelled. At the end the page offers to open the project in this window, in a new one, or to add it to the workspace.&lt;/p&gt;

&lt;p&gt;The cards and the form are built from the templates themselves. A new template in the redb packages shows up on the page without an extension update.&lt;/p&gt;

&lt;h2&gt;
  
  
  The route project
&lt;/h2&gt;

&lt;p&gt;From here the example uses the &lt;strong&gt;redb.Route XML module: files&lt;/strong&gt; template (&lt;code&gt;redb-route-file&lt;/code&gt;). It needs no server at all: an inbox folder, an XSD check, folders for processed and failed files, a receipt per file. From a terminal it is the same command the page runs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet new install redb.Templates
dotnet new redb-route-file -n Orders
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Orders/
  .config/dotnet-tools.json        the redb-route-xml local tool
  context.xml                      the context document: beans, C# routes
  routes/files.route.xml           two XML routes
  routes/CsvFilesRoute.cs          the same pattern for CSV in C#
  resources/order.xsd              the order schema
  config/orders.config.json        context name and auto start, shipped in the package
  config/context.sample.json       a deployment sample of the settings
  deploy/docker-compose.files.yml  the module on a Tsak worker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The layout is a convention of the format. Routes live in &lt;code&gt;routes/&lt;/code&gt;, the resources they refer to by name in &lt;code&gt;resources/&lt;/code&gt;. &lt;code&gt;context.xml&lt;/code&gt; loads before the routes, so the routes see its beans. The package carries only the module's identity, &lt;code&gt;orders.config.json&lt;/code&gt;, while settings come from the worker's configuration: the same package goes to staging and production without a rebuild.&lt;/p&gt;

&lt;h2&gt;
  
  
  Markup by example
&lt;/h2&gt;

&lt;p&gt;Here is the template's second route, the one that processes incoming files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;routes&lt;/span&gt; &lt;span class="na"&gt;xmlns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"urn:redb:route:1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;route&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"orders-files-in"&lt;/span&gt; &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Processes the files of the inbox"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;from&lt;/span&gt; &lt;span class="na"&gt;uri&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"file://{{files.inbox:inbox}}?antInclude=*.xml&amp;amp;amp;delay=5000&amp;amp;amp;moveTo=done&amp;amp;amp;moveFailed=error"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;convertBody&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"System.String"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;validateXsd&lt;/span&gt; &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"resources/order.xsd"&lt;/span&gt; &lt;span class="na"&gt;throwOnFailure&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;log&lt;/span&gt; &lt;span class="na"&gt;level&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Information"&lt;/span&gt; &lt;span class="na"&gt;showRouteId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;message&amp;gt;&lt;/span&gt;processed ${header.redbFile.NameOnly}: ${body}&lt;span class="nt"&gt;&amp;lt;/message&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/log&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;setBody&lt;/span&gt; &lt;span class="na"&gt;expr&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"received ${header.redbFile.NameOnly}"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;to&lt;/span&gt; &lt;span class="na"&gt;uri&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"file://{{files.outbox:outbox}}?fileName=${header.redbFile.NameOnly}.receipt"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/route&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/routes&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Five things are enough to read any route:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;&amp;lt;from&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;to&amp;gt;&lt;/code&gt;&lt;/strong&gt; are the input and the output. The URI works as in C# routes: the connector scheme, a path, options. A long endpoint can be written as a structure, for example &lt;code&gt;&amp;lt;to&amp;gt;&amp;lt;sql dataSource="#main-db"&amp;gt;&lt;/code&gt; with the query text inside.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Steps run top to bottom:&lt;/strong&gt; turn the body into a string, check it against the XSD, log it, replace the body, send a receipt. If a file fails the schema, the exception sends it to &lt;code&gt;error/&lt;/code&gt; through the &lt;code&gt;moveFailed&lt;/code&gt; option.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;{{files.inbox:inbox}}&lt;/code&gt;&lt;/strong&gt; is a configuration placeholder with a default. It resolves from the worker's configuration. A key with no default goes into the package manifest as required.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;${header...}&lt;/code&gt; and &lt;code&gt;expr&lt;/code&gt;&lt;/strong&gt; are the expression language, the same as in C# routes. In a condition the string becomes a predicate, in a value it is evaluated.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Branching and error handling&lt;/strong&gt; are elements: &lt;code&gt;&amp;lt;choice&amp;gt;&lt;/code&gt; with &lt;code&gt;&amp;lt;when expr="..."&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;otherwise&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;tryCatch&amp;gt;&lt;/code&gt; with &lt;code&gt;&amp;lt;try&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;catch&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;finally&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;transaction&amp;gt;&lt;/code&gt; around steps that commit together. The template's first route, the test file generator, uses &lt;code&gt;&amp;lt;choice&amp;gt;&lt;/code&gt;: every fifth file it makes deliberately not XML.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The loader turns the markup into the same DSL calls you write in C#, so everything the engine can do the XML can do: retries, transactions, message history, metrics, mocks in tests. The format, the package check and swapping a module on the fly are covered in detail in &lt;a href="https://redbase.app/articles/route-xml-markup" rel="noopener noreferrer"&gt;XML routes in redb.Route&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Schema completion
&lt;/h2&gt;

&lt;p&gt;The document starts with the &lt;code&gt;urn:redb:route:1.0&lt;/code&gt; namespace. That is how Red Hat XML picks the schema the extension ships, and from then on you get completion of elements and attributes, enum values and validation as you type. The binding goes by namespace, not by file name: someone else's &lt;code&gt;route.xml&lt;/code&gt; without our namespace is left alone.&lt;/p&gt;

&lt;p&gt;The schema knows the typed options of every connector. Type &lt;code&gt;&amp;lt;to&amp;gt;&amp;lt;kafka&lt;/code&gt; and a space inside a route, and the editor offers &lt;code&gt;topic&lt;/code&gt;, &lt;code&gt;brokers&lt;/code&gt;, &lt;code&gt;key&lt;/code&gt;, &lt;code&gt;acks&lt;/code&gt;, &lt;code&gt;compressionType&lt;/code&gt; and a few dozen more Kafka options with their types and allowed values.&lt;/p&gt;

&lt;p&gt;The schema also knows the sides of an endpoint. An option that only a producer takes is flagged as an error inside &lt;code&gt;&amp;lt;from&amp;gt;&lt;/code&gt;: AS4's &lt;code&gt;addressQuery&lt;/code&gt;, for example, gives "The 'addressQuery' attribute is not allowed". The error shows in the editor, before the build and before the run.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;context.xml&lt;/code&gt; gets the same help: inside &lt;code&gt;&amp;lt;context&amp;gt;&lt;/code&gt;, after &lt;code&gt;&amp;lt;&lt;/code&gt; the editor offers &lt;code&gt;bean&lt;/code&gt;, &lt;code&gt;components&lt;/code&gt;, &lt;code&gt;dataFormat&lt;/code&gt;, &lt;code&gt;deadLetterChannel&lt;/code&gt;, &lt;code&gt;onInit&lt;/code&gt;, &lt;code&gt;redb&lt;/code&gt;, &lt;code&gt;routeBuilder&lt;/code&gt;, &lt;code&gt;routeConfiguration&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Nobody writes the schema by hand. The &lt;code&gt;redb-route-xml&lt;/code&gt; tool generates it from the connector assemblies at each redb.Route release, and the release checks that the schema in the extension matches its assemblies. A new connector option reaches the editor with the next extension version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Skeletons
&lt;/h2&gt;

&lt;p&gt;Some constructs the schema cannot offer as a whole: a route without &lt;code&gt;from&lt;/code&gt; or a &lt;code&gt;choice&lt;/code&gt; without branches makes no sense. For those there are three skeletons, inserted wherever a new element may start:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Inserts&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;route&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;a route with its consumer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;choice&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;a choice with a &lt;code&gt;when&lt;/code&gt; branch and &lt;code&gt;otherwise&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;tryCatch&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;a &lt;code&gt;try&lt;/code&gt; block with &lt;code&gt;catch&lt;/code&gt; and &lt;code&gt;finally&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;They are offered only in redb route documents and only where an element may stand: not inside an attribute and not in foreign XML.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bean references
&lt;/h2&gt;

&lt;p&gt;Registry objects, connection factories and handlers, are declared with &lt;code&gt;&amp;lt;bean name="..."&amp;gt;&lt;/code&gt;, and a route refers to them with &lt;code&gt;#&lt;/code&gt;. Type &lt;code&gt;#&lt;/code&gt; and the editor lists the names of the declared beans. The hint works in three places: the whole attribute value (&lt;code&gt;dataSource="#"&lt;/code&gt;), right after the URI scheme (&lt;code&gt;bean:#&lt;/code&gt;) and a URI option value (&lt;code&gt;?headerFilterStrategy=#&lt;/code&gt;). A &lt;code&gt;#&lt;/code&gt; inside other text, such as the SQL parameter &lt;code&gt;:#login&lt;/code&gt;, is not a reference and gets no hint.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;routes&lt;/span&gt; &lt;span class="na"&gt;xmlns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"urn:redb:route:1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;bean&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"main-db"&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"redb.Route.Sql.Connection.SqlConnectionFactory, redb.Route.Sql"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;constructorArg&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;bean&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"redb.Route.Sql.Connection.SqlConnectionOptions, redb.Route.Sql"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;property&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"ConnectionString"&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"{{db.main.connection}}"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/bean&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/constructorArg&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/bean&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;route&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"audit"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;from&lt;/span&gt; &lt;span class="na"&gt;uri&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"direct://audit"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;to&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;sql&lt;/span&gt; &lt;span class="na"&gt;dataSource&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"#main-db"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;  &lt;span class="c"&gt;&amp;lt;!-- here # offers main-db --&amp;gt;&lt;/span&gt;
        &lt;span class="cp"&gt;&amp;lt;![CDATA[ INSERT INTO audit_log(at) VALUES (CURRENT_TIMESTAMP) ]]&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/sql&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/to&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/route&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/routes&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The limit in version 0.2.25: the hint sees only the beans of the current file and does not filter them by type. The redb templates declare their beans in &lt;code&gt;context.xml&lt;/code&gt;, so in a template's route file &lt;code&gt;#&lt;/code&gt; offers nothing yet. A wrong or dangling reference is caught either way by &lt;code&gt;redb-route-xml check&lt;/code&gt; and &lt;code&gt;pack&lt;/code&gt;: the bean's type, methods and properties are checked against the real assemblies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Route tree
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;redb&lt;/strong&gt; button in the Activity Bar opens the &lt;strong&gt;Routes&lt;/strong&gt; view: every routes document in the workspace (&lt;code&gt;*.route.xml&lt;/code&gt;, &lt;code&gt;*.redb-route.xml&lt;/code&gt;), and for each route its &lt;code&gt;id&lt;/code&gt; and &lt;code&gt;from&lt;/code&gt; endpoint. A click opens the file at the route's line. The tree refreshes by itself when files are created, edited or deleted, and covers every folder of the workspace. Without routes, the view offers to create a project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjxb6snsr7sojntohmdj9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjxb6snsr7sojntohmdj9.png" alt="Route tree and route text" width="800" height="587"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The shot shows the serial number request route from the SerialNumbers.Xml demo: an XSD check in &lt;code&gt;tryCatch&lt;/code&gt;, a decision in a transaction, two choices. It reads well as text, but where the transaction ends and where a message goes without a matching branch is easier to see in the graph.&lt;/p&gt;

&lt;h2&gt;
  
  
  Route graph
&lt;/h2&gt;

&lt;p&gt;The graph button in the editor title, &lt;strong&gt;Open With&lt;/strong&gt; and &lt;strong&gt;redb Route Graph&lt;/strong&gt;, or &lt;strong&gt;redb Route: Open Route Graph&lt;/strong&gt; open the same file as a graph. The graph is a second view of the same text: every edit in it is an edit of the XML and is undone with the usual &lt;code&gt;Ctrl+Z&lt;/code&gt;. The file is never reserialized and every edit is a point replacement: comments, indentation and attribute order in untouched text stay as the author left them, and a new attribute added from the panel goes last in the tag. A step moves or is deleted together with the comment lines directly above it (a blank line breaks the link, a comment below the step stays put) and takes the indentation of its new place. The text editor stays the default.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzkt52umuz5n58q9as811.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzkt52umuz5n58q9as811.png" alt="The serial numbers route as a graph" width="799" height="586"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How to read the graph:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tiles of one size&lt;/strong&gt; with glyphs in the Enterprise Integration Patterns notation and a short caption: &lt;code&gt;from&lt;/code&gt;, &lt;code&gt;bean&lt;/code&gt;, &lt;code&gt;sql&lt;/code&gt;, &lt;code&gt;choice&lt;/code&gt;, &lt;code&gt;loop&lt;/code&gt;, &lt;code&gt;log&lt;/code&gt;. What a step does (the property name, the condition, the SQL) is in the tooltip and the properties panel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wrappers on the route line.&lt;/strong&gt; &lt;code&gt;transaction&lt;/code&gt;, &lt;code&gt;loop&lt;/code&gt;, &lt;code&gt;split&lt;/code&gt;, &lt;code&gt;metered&lt;/code&gt; put their steps between their own tile and an &lt;code&gt;end&lt;/code&gt; tile; &lt;code&gt;choice&lt;/code&gt;, &lt;code&gt;tryCatch&lt;/code&gt; and &lt;code&gt;filter&lt;/code&gt; fan out into branches. A run of &lt;code&gt;setHeader&lt;/code&gt; and &lt;code&gt;setProperty&lt;/code&gt; steps folds into one &lt;code&gt;set ×N&lt;/code&gt; tile.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Paths by meaning.&lt;/strong&gt; Conditional paths are dashed: orange where a message goes past a step (filter not passed, no branch matched, a duplicate), grey with a cross where it is dropped (&lt;code&gt;sample&lt;/code&gt;, &lt;code&gt;debounce&lt;/code&gt;), red where a step throws. In the shot the orange "no match" path goes around both branches of the &lt;code&gt;choice&lt;/code&gt; inside the transaction.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Colors by role.&lt;/strong&gt; Green in, blue out, purple your code (&lt;code&gt;bean&lt;/code&gt;), orange data changes, cyan routing, grey observation, red errors.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What you can do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;See an endpoint taken apart.&lt;/strong&gt; For a step with a URI the properties panel splits it into the scheme, the path and the connector's options, with enum values picked from a list. A sensitive option, a password or a key, is masked and cannot be edited from the panel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;See the settings.&lt;/strong&gt; A &lt;code&gt;{{files.inbox:inbox}}&lt;/code&gt; value is shown together with what it resolves to: the graph reads &lt;code&gt;config/context.sample.json&lt;/code&gt; and &lt;code&gt;config/*.config.json&lt;/code&gt; next to the file or up to three folders above it, and merges them the way a Tsak worker does. An edit always keeps the placeholder itself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Edit with the mouse.&lt;/strong&gt; Insert a step from the palette at any "+" between steps, delete it with &lt;code&gt;Delete&lt;/code&gt;, drag it to a new place or into a container, rename it; attributes and texts are edited in the properties panel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Change the layout.&lt;/strong&gt; Left to right or top down, fold or unfold every container at once, zoom, fold a route to its title.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Among the templates, &lt;code&gt;redb-route-eip&lt;/code&gt; gives the most telling graph: its &lt;code&gt;routes/orders.route.xml&lt;/code&gt; has six integration patterns in a row.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mermaid diagrams
&lt;/h2&gt;

&lt;p&gt;The graph lives in the editor, while a README, a wiki or a ticket needs a picture that will not drift from the code. &lt;strong&gt;redb Route: Show Mermaid Diagram&lt;/strong&gt; saves the current file, runs the &lt;code&gt;redb-route-xml mermaid&lt;/code&gt; tool and opens the diagram text in a new Markdown tab. It needs the .NET tool:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet tool install -g redb.Route.Xml.CodeGen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A project from a template already has it in its local manifest, and the same diagram comes from a terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet tool restore
dotnet redb-route-xml mermaid routes/files.route.xml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the output for the routes of the &lt;code&gt;redb-route-file&lt;/code&gt; template, unedited:&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TD
  n0["orders-files-feed: timer://orders-files-feed?period={{fil..."]
  n1{"choice"}
  n0 --&amp;gt; n1
  n2{{"when: header.CamelTimerCounter % 5 == 4"}}
  n1 -.-&amp;gt; n2
  n3["setBodyStatic"]
  n2 --&amp;gt; n3
  n4(["otherwise"])
  n1 -.-&amp;gt; n4
  n5["setBodyExpression"]
  n4 --&amp;gt; n5
  n6[["file://{{files.inbox:inbox}}?fileName=order-${header.Came..."]]
  n3 --&amp;gt; n6
  n5 --&amp;gt; n6
  n7["orders-files-in: file://{{files.inbox:inbox}}?antInclude=..."]
  n8["convertBody"]
  n7 --&amp;gt; n8
  n9["validateXsdNamespace"]
  n8 --&amp;gt; n9
  n10["richLogScope"]
  n9 --&amp;gt; n10
  n11["setBodyExpression"]
  n10 --&amp;gt; n11
  n12[["file://{{files.outbox:outbox}}?fileName=${header.redbFile..."]]
  n11 --&amp;gt; n12&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;It is text, not a picture: GitHub, GitLab and most wikis render such a block themselves, and in VS Code you see it through the Markdown preview plus a Mermaid extension. The diagram is built from the same definition tree as the running route: a diamond for &lt;code&gt;choice&lt;/code&gt;, a hexagon for the condition, a stadium for &lt;code&gt;otherwise&lt;/code&gt;, a double frame for a sending endpoint. Node captions are engine step names (&lt;code&gt;setBodyExpression&lt;/code&gt;, &lt;code&gt;richLogScope&lt;/code&gt;), not markup elements, and long URIs are cut short.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check and pack
&lt;/h2&gt;

&lt;p&gt;The route is written and the graph has been checked by eye. Next comes the same check as on a build server, only on your machine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet build -p:PackRouteOnBuild=true -p:Version=1.0.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The build checks the markup against the schema, every endpoint option against its connector, the beans against the real assemblies, resources such as &lt;code&gt;resources/order.xsd&lt;/code&gt; and the configuration keys, then writes the package &lt;code&gt;pkg/orders-1.0.0.tpkg&lt;/code&gt;. An error in the markup becomes a build error, and a package with an error is not built. Without a package, the same checks run with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet redb-route-xml check .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What else it finds, such as literal secrets in a URI or dangling bean references, and what its messages look like is shown in the &lt;a href="https://redbase.app/articles/route-xml-markup" rel="noopener noreferrer"&gt;article about the format&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  On to the worker
&lt;/h2&gt;

&lt;p&gt;The template brings a stand too: the compose file starts the Tsak worker image and mounts &lt;code&gt;pkg/&lt;/code&gt; as its module folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose -f deploy/docker-compose.files.yml up -d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The log shows &lt;code&gt;processed order-N.xml: ...&lt;/code&gt; lines. Every fifth test file is deliberately not XML: it fails the schema and goes to &lt;code&gt;error/&lt;/code&gt;, the rest get a receipt in &lt;code&gt;outbox&lt;/code&gt;. On a worker of your own it is enough to drop the &lt;code&gt;.tpkg&lt;/code&gt; into its &lt;code&gt;modules&lt;/code&gt; folder: the worker loads the module by itself and unloads it the same way when the file is removed. Settings go in &lt;code&gt;context.json&lt;/code&gt; next to the package or in the worker's configuration. How Tsak builds services out of such modules is covered in the article &lt;a href="https://redbase.app/articles/tsak-microservices" rel="noopener noreferrer"&gt;about microservices on Tsak&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What&lt;/th&gt;
&lt;th&gt;Today&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Own language server, hover, diagnostics&lt;/td&gt;
&lt;td&gt;none: validation and messages come from Red Hat XML against the schema&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Extension settings&lt;/td&gt;
&lt;td&gt;none: the schema catalog is registered with Red Hat XML through its API&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;#&lt;/code&gt; hints&lt;/td&gt;
&lt;td&gt;beans of the current file, no type filter&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;New connector options&lt;/td&gt;
&lt;td&gt;arrive with the next extension version&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mermaid diagram&lt;/td&gt;
&lt;td&gt;Markdown text, needs the &lt;code&gt;redb-route-xml&lt;/code&gt; tool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;New Project&lt;/td&gt;
&lt;td&gt;needs a .NET SDK; template packages install with one click&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Offline&lt;/td&gt;
&lt;td&gt;schema, tree, graph and skeletons work; installing also needs the Red Hat XML &lt;code&gt;.vsix&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;After an update&lt;/td&gt;
&lt;td&gt;the &lt;strong&gt;redb&lt;/strong&gt; Activity Bar button appears after &lt;strong&gt;Developer: Reload Window&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Open VSX&lt;/td&gt;
&lt;td&gt;no; for VSCodium and Cursor there is the &lt;code&gt;.vsix&lt;/code&gt; from the release&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Versions
&lt;/h2&gt;

&lt;p&gt;The extension has its own numbering, 0.2.x, which does not move with the redb packages. Every redb.Route release regenerates the schema, the element list and the bean catalog from its assemblies and checks them against what the extension ships. The extension first reached the Marketplace on October 23, 2026; version 0.2.25 went up on October 29 and matches the &lt;a href="https://github.com/redbase-app/redb-route/releases/tag/v4.6.0" rel="noopener noreferrer"&gt;redb-route v4.6.0&lt;/a&gt; release, which carries the same &lt;code&gt;.vsix&lt;/code&gt;. The extension is licensed under Apache 2.0.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;If this was useful, a ⭐ on &lt;a href="https://github.com/redbase-app" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; helps others find it.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;More of my writing: &lt;a href="https://redbase.app/articles" rel="noopener noreferrer"&gt;redbase.app/articles&lt;/a&gt;, and on &lt;a href="https://dev.to/rinat_kozin"&gt;dev.to&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>vscode</category>
      <category>xml</category>
      <category>eip</category>
    </item>
    <item>
      <title>EF Core vs redb: an object graph against 54 tables and Include</title>
      <dc:creator>rinat kozin</dc:creator>
      <pubDate>Wed, 04 Nov 2026 23:37:50 +0000</pubDate>
      <link>https://dev.to/rinat_kozin/ef-core-vs-redb-an-object-graph-against-54-tables-and-include-19j2</link>
      <guid>https://dev.to/rinat_kozin/ef-core-vs-redb-an-object-graph-against-54-tables-and-include-19j2</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmgsg5k0fp9cvqzjwbe41.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmgsg5k0fp9cvqzjwbe41.png" alt="redb.Core" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An employee with addresses, contacts and dictionaries: 54 tables and 31 Include calls in EF Core, one class in &lt;strong&gt;redb&lt;/strong&gt; Pro. Measured on 100k objects: who wins where&lt;/p&gt;

&lt;p&gt;One employee from our examples takes 62 SQL queries and almost two seconds to read in EF Core. In redb Pro the same employee, from the same data and in the same shape, takes 131 ms and nine queries, and 36 ms and five on the repeat run. The difference is not that one engine is "fast" and the other "slow". It is how many tables have to be put back together to get one business object out of the database.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fll21pvbe2dh3abcbmd1z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fll21pvbe2dh3abcbmd1z.png" alt="redb vs EF" width="767" height="717"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Below: what exactly we compared, why a graph is expensive in normal form, how redb Pro learned to read it without folding everything, and where EF Core is simply faster. There are quite a few such places, and they are in the tables too.&lt;/p&gt;

&lt;h2&gt;
  
  
  The object under test
&lt;/h2&gt;

&lt;p&gt;Every measurement uses one model from the examples project. Shortened, it looks like this (the full class is in the repository, &lt;code&gt;redb.Examples/Models/ExampleModels.cs&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;RedbScheme&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Employee"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;EmployeeProps&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;FirstName&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Empty&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nc"&gt;Age&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;decimal&lt;/span&gt; &lt;span class="nc"&gt;Salary&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Department&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Empty&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="nc"&gt;Skills&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="nc"&gt;SkillLevels&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;Address&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="nc"&gt;HomeAddress&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;        &lt;span class="c1"&gt;// Address -&amp;gt; BuildingInfo -&amp;gt; arrays&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;Address&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="nc"&gt;WorkAddress&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;Contact&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="nc"&gt;Contacts&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;          &lt;span class="c1"&gt;// Contact -&amp;gt; ContactDetail[]&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;RedbObject&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ProjectMetricsProps&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;?&lt;/span&gt; &lt;span class="nc"&gt;CurrentProject&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;Dictionary&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Address&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;?&lt;/span&gt; &lt;span class="nc"&gt;OfficeLocations&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;Dictionary&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;decimal&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;?&lt;/span&gt; &lt;span class="nc"&gt;BonusByYear&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;Dictionary&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nc"&gt;Year&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nc"&gt;Quarter&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;?&lt;/span&gt; &lt;span class="nc"&gt;PerformanceReviews&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A typical business object: a few scalar fields, three addresses with a nested building, an array of contacts with metadata, dictionaries, references to other objects. For redb it is one class with an attribute. The database scheme is created from it at start-up, with no migrations.&lt;/p&gt;

&lt;h2&gt;
  
  
  The same object for EF Core
&lt;/h2&gt;

&lt;p&gt;To keep the comparison fair, EF Core got the same model in normal form, with no JSON columns. We did not build it by hand but with our own tool: the &lt;code&gt;redb flat&lt;/code&gt; command of &lt;code&gt;redb.CLI&lt;/code&gt; unfolds redb classes into relational tables.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;redb flat -a redb.Examples.dll -tp postgres --ddl-only
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without &lt;code&gt;--ddl-only&lt;/code&gt; the same command also copies the data from a redb database into the flat tables. That is useful outside benchmarks as well, whenever analysts or reports need a plain relational copy.&lt;/p&gt;

&lt;p&gt;The result is 54 tables and 59 foreign keys: a table for every nested class, every array and every dictionary, and a collection inside a collection element goes one level further down. The EF classes were generated by the standard &lt;code&gt;dotnet ef dbcontext scaffold&lt;/code&gt; and left untouched.&lt;/p&gt;

&lt;p&gt;Next comes what an EF developer writes by hand. Reading an employee as a whole takes 31 &lt;code&gt;Include&lt;/code&gt; calls (excerpt):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="nc"&gt;IQueryable&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;EmployeeProps&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;WithGraph&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt; &lt;span class="nc"&gt;IQueryable&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;EmployeeProps&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Include&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Include&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;EmployeeProps_Skills&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Include&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;EmployeeProps_HomeAddress&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ThenInclude&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;EmployeeProps_HomeAddress_Building&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ThenInclude&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;EmployeeProps_HomeAddress_Building_Amenities&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Include&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;EmployeeProps_Contacts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ThenInclude&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;EmployeeProps_Contacts_Metadata&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;// ... 25 more chains&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;AsSplitQuery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;AsSplitQuery&lt;/code&gt; is mandatory here. One query joining 30 independent collections would multiply rows: skills by contacts, contacts by offices and so on. With splitting, EF sends one query per collection, hence 31 queries for every graph read. Why &lt;code&gt;Include&lt;/code&gt; turns into a discipline of its own in large models is covered on our &lt;a href="https://redbase.app/why-redbase" rel="noopener noreferrer"&gt;Why redb&lt;/a&gt; page.&lt;/p&gt;

&lt;p&gt;One more thing: EF returns entities of 54 tables, while the application needs the business class. So there has to be a mapping that assembles &lt;code&gt;EmployeeProps&lt;/code&gt; from those entities. redb returns &lt;code&gt;RedbObject&amp;lt;EmployeeProps&amp;gt;&lt;/code&gt; directly, with no layer in between.&lt;/p&gt;

&lt;p&gt;How much code the EF side needed to return the same object:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What&lt;/th&gt;
&lt;th&gt;Lines&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Entity classes from scaffold, 54 files&lt;/td&gt;
&lt;td&gt;1,124&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;DbContext&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;930&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;Include&lt;/code&gt; graph and mapping of the employee to the business class&lt;/td&gt;
&lt;td&gt;about 360&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The mapping time is part of the EF measurement, because we compare the path to one and the same result: a ready business object. For a business, something else matters more. Every model change in EF means a migration and edits to entities, &lt;code&gt;Include&lt;/code&gt; chains and the mapping. In redb only the class changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  How redb stores a graph
&lt;/h2&gt;

&lt;p&gt;redb has no table per class. Objects live in one table and field values in another, one row per field. A nested class, an array element or a dictionary entry is also a value row linked to its parent. A graph of any depth is stored in the same two tables.&lt;/p&gt;

&lt;p&gt;That has a simple consequence for reads. To load N objects as a whole, redb Pro reads the object rows and then all values of all N objects in one query; if values point at list items, one more query fetches them. Nested references to other objects add one such round per level of depth. The query count follows reference depth, not the number of fields or collections. Scheme and type metadata are checked alongside, and with the props cache on, objects already in the cache get a hash check instead of a values read. The props tree is built in memory. So an employee with 30 collections takes nine queries on the first run and five on the repeat in our runs, never thirty-one.&lt;/p&gt;

&lt;p&gt;Loading objects from a ready list of ids is the easy part, though. The hard part is finding that list: filtering, sorting and taking a page by fields that are stored as rows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before: fold everything, then filter
&lt;/h2&gt;

&lt;p&gt;A LINQ query over fields used to rebuild the object with a "pivot". It read all value rows of the fields involved across the whole scheme, folded them with &lt;code&gt;GROUP BY&lt;/code&gt; per object, and only then applied the filter, the sort and the page.&lt;/p&gt;

&lt;p&gt;The cost of such a query depended on the size of the scheme, not on the answer. Finding one employee or none cost the same: the database folded everything first. Version 3.7.1 added a prefilter that narrows the rows before folding (it has &lt;a href="https://redbase.app/articles/pvt-prefilter" rel="noopener noreferrer"&gt;its own article&lt;/a&gt;). It helped wherever the condition could be expressed at the level of a value row, but the folding stayed.&lt;/p&gt;

&lt;h2&gt;
  
  
  After: streams
&lt;/h2&gt;

&lt;p&gt;redb Pro 4.3.0 added a new query form that we call "streams" internally. The objects of the scheme now drive the query, and each field joins the value table with its own &lt;code&gt;LEFT JOIN&lt;/code&gt;. Nothing is folded. The filter, the sort and the page sit next to the joins, and the server can stop once the page is full.&lt;/p&gt;

&lt;p&gt;Here is how it looks for a query with three conditions, sorted by salary, with a page at offset 9000. The SQL is simplified: parameters and the trash check are removed, the shape is the real one.&lt;/p&gt;

&lt;p&gt;Before:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="n"&gt;pvt_cte&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_object&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;array_agg&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="k"&gt;FILTER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_structure&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1000019&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_array_index&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="s2"&gt;"Position"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;array_agg&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_long&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;    &lt;span class="k"&gt;FILTER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_structure&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1000017&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_array_index&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="s2"&gt;"Age"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;array_agg&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_numeric&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;FILTER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_structure&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1000020&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_array_index&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="s2"&gt;"Salary"&lt;/span&gt;
  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;_values&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;
  &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_structure&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;ANY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;ARRAY&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1000019&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1000017&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1000020&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_object&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;_id&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;_objects&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;_id_scheme&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1000014&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_object&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;pvt_cte&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;_objects&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pvt_cte&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_object&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="s2"&gt;"Position"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="s2"&gt;"Age"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="s2"&gt;"Salary"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;70000&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="s2"&gt;"Salary"&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt; &lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="k"&gt;OFFSET&lt;/span&gt; &lt;span class="mi"&gt;9000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="n"&gt;pvt_cte&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;pvt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_object&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pvt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="s2"&gt;"Position"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pvt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="s2"&gt;"Age"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pvt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="s2"&gt;"Salary"&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;o_src&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;_id_object&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_string&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="s2"&gt;"Position"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_long&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="s2"&gt;"Age"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_numeric&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="s2"&gt;"Salary"&lt;/span&gt;
    &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;_objects&lt;/span&gt; &lt;span class="n"&gt;o_src&lt;/span&gt;
    &lt;span class="k"&gt;LEFT&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;_values&lt;/span&gt; &lt;span class="n"&gt;f1&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;f1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_object&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;o_src&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;f1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_structure&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1000019&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;f1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_array_index&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;
    &lt;span class="k"&gt;LEFT&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;_values&lt;/span&gt; &lt;span class="n"&gt;f2&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;f2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_object&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;o_src&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;f2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_structure&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1000017&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;f2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_array_index&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;
    &lt;span class="k"&gt;LEFT&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;_values&lt;/span&gt; &lt;span class="n"&gt;f3&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;f3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_object&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;o_src&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;f3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_structure&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1000020&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;f3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_array_index&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;
    &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;o_src&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_scheme&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1000014&lt;/span&gt;
    &lt;span class="k"&gt;OFFSET&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;pvt&lt;/span&gt;
  &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;pvt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="s2"&gt;"Position"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;pvt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="s2"&gt;"Age"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;pvt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="s2"&gt;"Salary"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;70000&lt;/span&gt;
  &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;pvt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="s2"&gt;"Salary"&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pvt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_object&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt; &lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="k"&gt;OFFSET&lt;/span&gt; &lt;span class="mi"&gt;9000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;pvt_cte&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;_objects&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pvt_cte&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_object&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_scheme&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1000014&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;pvt_cte&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="s2"&gt;"Salary"&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pvt_cte&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_id_object&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first plan has a 26 MB hash aggregate, a hash join and about 38 thousand pages read. The second has three merges (Merge Left Join) over an index where a field's rows are already ordered by object: no hashing, no sorting, about 7,500 pages, and memory does not grow with the scheme. On a database of 200k objects this page went from 702-740 ms to 362 ms; from a cold disk, 1.8-2.3 s against 0.6-0.8 s.&lt;/p&gt;

&lt;p&gt;The wide row is the same as before, so &lt;code&gt;OR&lt;/code&gt;, &lt;code&gt;NOT&lt;/code&gt; and arithmetic between fields work unchanged. The &lt;code&gt;OFFSET 0&lt;/code&gt; keeps PostgreSQL from pushing the filter down into the streams: in a value table the columns are correlated, while the statistics treat them as independent and misjudge row counts by tens of times.&lt;/p&gt;

&lt;p&gt;Streams read fields that have one value per object: plain fields, dictionary entries and fields of classes inside them, list items. On PostgreSQL and SQL Server this works with or without a page; on SQLite a plain list still needs &lt;code&gt;Take&lt;/code&gt;. Arrays, &lt;code&gt;DISTINCT&lt;/code&gt; and a sort computed by an expression over a base field stay on the old form.&lt;/p&gt;

&lt;h3&gt;
  
  
  Indexes: column order decides which question an index answers
&lt;/h3&gt;

&lt;p&gt;The most useful finding of this work was about indexes, not query shape. In the stock schema the value indexes were built as "structure, object, value". Such an index answers "what is this object's value", but not "which objects have this value". A filter needs the second.&lt;/p&gt;

&lt;p&gt;In 4.4.0 all three databases got "structure, value, object" indexes. They give two things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A narrow condition drives the query.&lt;/strong&gt; When the filter has a selective condition (equality, &lt;code&gt;IN&lt;/code&gt;, a closed range), the query starts from the value index and the other fields join to the objects it found. Finding one order number among 689k records on a copy of a production database went from 2.4 s to 30 ms.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The leading form for pages.&lt;/strong&gt; A page sorted by a field walks that field's index in page order, reads the other fields point by point and stops at the hundredth row. The first page of the three-condition query went from 229 ms to 2 ms. This is in PostgreSQL Pro and SQLite Pro.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What streams brought on three databases
&lt;/h2&gt;

&lt;p&gt;Measured on the examples database (100k employees, 8.4 million value rows as of October 12-13, 2026), warm cache, times in milliseconds.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PostgreSQL:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Query&lt;/th&gt;
&lt;th&gt;Pivot&lt;/th&gt;
&lt;th&gt;Streams&lt;/th&gt;
&lt;th&gt;Streams with new indexes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;count with two conditions&lt;/td&gt;
&lt;td&gt;162-165&lt;/td&gt;
&lt;td&gt;153&lt;/td&gt;
&lt;td&gt;61&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;page with filter and sort&lt;/td&gt;
&lt;td&gt;365-382&lt;/td&gt;
&lt;td&gt;305&lt;/td&gt;
&lt;td&gt;183&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;page, sort only&lt;/td&gt;
&lt;td&gt;335-340&lt;/td&gt;
&lt;td&gt;146&lt;/td&gt;
&lt;td&gt;84&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;count with array &lt;code&gt;Contains&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;350-359&lt;/td&gt;
&lt;td&gt;110&lt;/td&gt;
&lt;td&gt;43&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;batch of aggregates&lt;/td&gt;
&lt;td&gt;370-389&lt;/td&gt;
&lt;td&gt;146&lt;/td&gt;
&lt;td&gt;66&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Without the new indexes, streams were not slower than the pivot in any of the eleven queries measured; with them, 2-8x faster.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SQL Server.&lt;/strong&gt; The gap is wider here: the pivot cost seconds and up to 1.2 GB of memory per query.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Query&lt;/th&gt;
&lt;th&gt;Pivot&lt;/th&gt;
&lt;th&gt;Streams&lt;/th&gt;
&lt;th&gt;Faster by&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;page by salary, wide filter&lt;/td&gt;
&lt;td&gt;1,090&lt;/td&gt;
&lt;td&gt;66&lt;/td&gt;
&lt;td&gt;17x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;page by age and last name, narrow filter&lt;/td&gt;
&lt;td&gt;7,327&lt;/td&gt;
&lt;td&gt;157&lt;/td&gt;
&lt;td&gt;47x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;count, filter by department&lt;/td&gt;
&lt;td&gt;2,917&lt;/td&gt;
&lt;td&gt;88&lt;/td&gt;
&lt;td&gt;33x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;group by department&lt;/td&gt;
&lt;td&gt;3,217&lt;/td&gt;
&lt;td&gt;116&lt;/td&gt;
&lt;td&gt;28x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;rank within department by salary, 5k rows&lt;/td&gt;
&lt;td&gt;2,009&lt;/td&gt;
&lt;td&gt;63&lt;/td&gt;
&lt;td&gt;32x&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Without a single new index, on the stock schema, the gain is 4-25x.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SQLite.&lt;/strong&gt; It turned out that what matters most here is the connection, not the query shape. The stock SQLite page cache is 2 MB, the database file is 2.5 GB. Memory-mapping the file made any query reading more than a few thousand rows 2-3x faster, the old form included. With "value second" indexes, streams are 8-22x faster than the pivot; queries that read almost the whole scheme get nothing from the indexes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Production data
&lt;/h3&gt;

&lt;p&gt;Synthetic data is good for repeatability, but the real problems only show up on live data. Debugging ran on a copy of the production database of a transportation management application: 809k objects, 38.2 million value rows.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Query&lt;/th&gt;
&lt;th&gt;Before&lt;/th&gt;
&lt;th&gt;After&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;one order number, page (PostgreSQL)&lt;/td&gt;
&lt;td&gt;2,464&lt;/td&gt;
&lt;td&gt;30&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;page by weight, wide filter (PostgreSQL)&lt;/td&gt;
&lt;td&gt;3,895&lt;/td&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;a month of routes, count (SQL Server)&lt;/td&gt;
&lt;td&gt;639&lt;/td&gt;
&lt;td&gt;63&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;a month of routes, page by driver and trip (SQL Server)&lt;/td&gt;
&lt;td&gt;837&lt;/td&gt;
&lt;td&gt;165&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;In the SQL Server rows a good part of the gain came not from the query form but from how the &lt;code&gt;IN&lt;/code&gt; list is passed. The list used to go as one string through &lt;code&gt;STRING_SPLIT&lt;/code&gt;; the server expected 50 rows from it, got 80 thousand and planned for the wrong estimate. Separate parameters made both the old and the new form 2-5x faster.&lt;/p&gt;

&lt;p&gt;The production copy also showed what the synthetic data did not: queries with no gain and a row estimate error that had to be worked around separately. The real application's queries on this copy gave 157 correct answers out of 157.&lt;/p&gt;

&lt;h3&gt;
  
  
  Speed-up as a correctness check
&lt;/h3&gt;

&lt;p&gt;We checked every answer of the new form not against the old form but against a count done in memory over the loaded objects. Comparing "planner on versus off" cannot see an error that both forms make. This check found 15 result errors in old and shared code: an object without a field value that vanished from &lt;code&gt;Where(x =&amp;gt; x.F == null)&lt;/code&gt;, tree aggregates that counted over the whole scheme, a page count that ignored &lt;code&gt;Take&lt;/code&gt; and &lt;code&gt;Skip&lt;/code&gt;, and others. All 15 are fixed in redb Pro on the three databases; the regression tests pass with the planner on and off.&lt;/p&gt;

&lt;h2&gt;
  
  
  redb Pro vs EF Core: methodology
&lt;/h2&gt;

&lt;p&gt;Now the comparison itself. The numbers below come from the run published on the &lt;a href="https://redbase.app/results" rel="noopener noreferrer"&gt;results page&lt;/a&gt;, where every example is listed row by row.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stand:&lt;/strong&gt; AMD Ryzen 5 5500U, 4 cores and 4 GB of memory per container; PostgreSQL 18, SQL Server Developer, SQLite.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Versions:&lt;/strong&gt; run of November 2, 2026, .NET 10; redb Pro built from source after the 4.5.1 release; EF Core 10.0.13 with Npgsql.EntityFrameworkCore.PostgreSQL 10.0.3.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data:&lt;/strong&gt; more than 100k objects and 8.5 million properties at the time of the run. Both databases are filled by the same generator (example E203), so the content matches and only the ids differ. Some examples create objects and were run a different number of times, so at run time the databases held about 100k and 110k employees. That does not change the order of magnitude.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Only redb Pro is compared.&lt;/strong&gt; The Pro packages (&lt;code&gt;redb.Core.Pro&lt;/code&gt;, &lt;code&gt;redb.Postgres.Pro&lt;/code&gt;, &lt;code&gt;redb.MSSql.Pro&lt;/code&gt;, &lt;code&gt;redb.SQLite.Pro&lt;/code&gt;) are closed-source but free of charge with no license key for the whole 3.x and 4.x lines, commercial production use included. They are enabled with &lt;code&gt;AddRedbPro()&lt;/code&gt; at configuration. Free runs queries in the old form: it folds the values first and filters after. Streams and the leading form are Pro only. Speeding up Free is separate work and a separate write-up.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EF Core on PostgreSQL only.&lt;/strong&gt; The EF twins were written and measured on PostgreSQL. They were not run on SQL Server or SQLite. The normal form there is the same, the same 54 tables and the same fan-out of queries, so the picture for complex graphs would be the same; we do not quote numbers for them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Plain LINQ only&lt;/strong&gt; on both sides, no raw SQL. Where EF cannot express a query (window functions, tree traversal with depth, soft delete), the table shows N/A with no time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Both sides got indexes.&lt;/strong&gt; For EF, the ones a developer would add for the filters: a trigram GIN for &lt;code&gt;Contains&lt;/code&gt;, &lt;code&gt;text_pattern_ops&lt;/code&gt; for &lt;code&gt;StartsWith&lt;/code&gt;, B-trees on filter and sort fields, composite "value, owner" indexes on collection tables. redb builds its indexes itself: the value indexes with each upgrade of its database module or schema, and Pro's streams indexes at start-up when they are missing. The exception is when the administrator keeps schema changes to themselves (&lt;code&gt;AutoApplyDatabaseUpgrades = false&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Time to a business object on both sides.&lt;/strong&gt; redb's time includes building &lt;code&gt;RedbObject&amp;lt;EmployeeProps&amp;gt;&lt;/code&gt;, EF's includes mapping the entities to the same class.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Settings:&lt;/strong&gt; JIT off in PostgreSQL for both sides; EF gets a new context from the factory for each example, change tracking on; model building and the first connection happen before the timer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Three runs:&lt;/strong&gt; the first; a repeat on warm data, where redb runs with the props cache on: the cache is empty at the start of the run and fills as it goes, so a second read of an object within one example may already come from the cache; and a third that reads through the filled cache. EF has no props cache: its repeat is compared with the third run. The per-example tables below come from the first run, where the cache plays no part.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A word about noise. The machine is shared and other work runs on it in parallel. Individual numbers drift from run to run, sometimes by 1.5-2x, so we do not count a difference below 1.5x as either a win or a loss. The order of magnitude is stable.&lt;/p&gt;

&lt;h2&gt;
  
  
  The numbers
&lt;/h2&gt;

&lt;p&gt;Median over the examples where both sides produced a result, PostgreSQL:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Run&lt;/th&gt;
&lt;th&gt;Examples&lt;/th&gt;
&lt;th&gt;redb Pro&lt;/th&gt;
&lt;th&gt;EF Core&lt;/th&gt;
&lt;th&gt;EF slower by&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;first&lt;/td&gt;
&lt;td&gt;110&lt;/td&gt;
&lt;td&gt;107 ms&lt;/td&gt;
&lt;td&gt;816 ms&lt;/td&gt;
&lt;td&gt;7.7x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;repeat&lt;/td&gt;
&lt;td&gt;102&lt;/td&gt;
&lt;td&gt;68 ms&lt;/td&gt;
&lt;td&gt;790 ms&lt;/td&gt;
&lt;td&gt;11.6x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;with props cache&lt;/td&gt;
&lt;td&gt;102&lt;/td&gt;
&lt;td&gt;61 ms&lt;/td&gt;
&lt;td&gt;790 ms&lt;/td&gt;
&lt;td&gt;13.0x&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Every example row by row, for all three databases and all three runs, is on &lt;a href="https://redbase.app/results" rel="noopener noreferrer"&gt;redbase.app/results&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Broken down by example (first run, 109 comparable pairs):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;th&gt;Examples&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;redb Pro faster by 5x or more&lt;/td&gt;
&lt;td&gt;54&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;of those, by 10x or more&lt;/td&gt;
&lt;td&gt;24&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;redb Pro faster by 1.25-5x&lt;/td&gt;
&lt;td&gt;26&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;about even&lt;/td&gt;
&lt;td&gt;13&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EF Core faster&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The big gaps are queries that return whole employees. First run, ms:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;th&gt;Query&lt;/th&gt;
&lt;th&gt;EF Core&lt;/th&gt;
&lt;th&gt;redb Pro&lt;/th&gt;
&lt;th&gt;Queries EF / redb&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;E002&lt;/td&gt;
&lt;td&gt;load an employee by id&lt;/td&gt;
&lt;td&gt;1,951&lt;/td&gt;
&lt;td&gt;131&lt;/td&gt;
&lt;td&gt;62 / 9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E010&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Where&lt;/code&gt; by salary, 100 objects&lt;/td&gt;
&lt;td&gt;927&lt;/td&gt;
&lt;td&gt;187&lt;/td&gt;
&lt;td&gt;31 / 5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E041&lt;/td&gt;
&lt;td&gt;filter on a field three levels deep&lt;/td&gt;
&lt;td&gt;765&lt;/td&gt;
&lt;td&gt;62&lt;/td&gt;
&lt;td&gt;31 / 7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E051&lt;/td&gt;
&lt;td&gt;array &lt;code&gt;Contains&lt;/code&gt;, several values with OR&lt;/td&gt;
&lt;td&gt;1,932&lt;/td&gt;
&lt;td&gt;76&lt;/td&gt;
&lt;td&gt;31 / 4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E060&lt;/td&gt;
&lt;td&gt;dictionary &lt;code&gt;ContainsKey&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;864&lt;/td&gt;
&lt;td&gt;76&lt;/td&gt;
&lt;td&gt;31 / 5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E080&lt;/td&gt;
&lt;td&gt;sort by salary&lt;/td&gt;
&lt;td&gt;2,835&lt;/td&gt;
&lt;td&gt;136&lt;/td&gt;
&lt;td&gt;58 / 8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E183&lt;/td&gt;
&lt;td&gt;&lt;code&gt;FirstOrDefaultAsync&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;2,919&lt;/td&gt;
&lt;td&gt;17&lt;/td&gt;
&lt;td&gt;32 / 5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E187&lt;/td&gt;
&lt;td&gt;update an existing object&lt;/td&gt;
&lt;td&gt;843&lt;/td&gt;
&lt;td&gt;51&lt;/td&gt;
&lt;td&gt;54 / 17&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Times and query counts are from the first run; the props cache plays no part in it. redb's query count includes scheme metadata lookups. E002 loads in two steps on both sides, first an employee and then the same one by id, hence EF's twice 31 queries.&lt;/p&gt;

&lt;p&gt;The "queries" column shows why EF loses here. Every query that returns employees turns into 31 SQL queries over the graph's tables in EF, plus assembling the entities and mapping them to the business class. The filter itself is fast in EF, the indexes are in place. Everything after the filter is what costs.&lt;/p&gt;

&lt;p&gt;Writes favour redb too, though less: bulk insert of complex objects (E000, first run) 873 ms against 1,515, and filling the database with 100k employees (E203) 335 objects per second against 237.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where EF Core is faster
&lt;/h2&gt;

&lt;p&gt;No caveats here: on flat data and scalar operations the flat table wins. First run, ms:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;th&gt;Query&lt;/th&gt;
&lt;th&gt;EF Core&lt;/th&gt;
&lt;th&gt;redb Pro&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;E164&lt;/td&gt;
&lt;td&gt;base-field operations on one object&lt;/td&gt;
&lt;td&gt;19&lt;/td&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E089&lt;/td&gt;
&lt;td&gt;a 101-node tree, one save per node (deliberate antipattern)&lt;/td&gt;
&lt;td&gt;702&lt;/td&gt;
&lt;td&gt;1,480&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E150&lt;/td&gt;
&lt;td&gt;sum and average over the array elements of all employees&lt;/td&gt;
&lt;td&gt;104&lt;/td&gt;
&lt;td&gt;491&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E150A&lt;/td&gt;
&lt;td&gt;aggregate over the array element at a given index&lt;/td&gt;
&lt;td&gt;26&lt;/td&gt;
&lt;td&gt;165&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E193&lt;/td&gt;
&lt;td&gt;average with a filter&lt;/td&gt;
&lt;td&gt;77&lt;/td&gt;
&lt;td&gt;161&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E194&lt;/td&gt;
&lt;td&gt;min and max with a filter&lt;/td&gt;
&lt;td&gt;160&lt;/td&gt;
&lt;td&gt;268&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E128&lt;/td&gt;
&lt;td&gt;simple grouping&lt;/td&gt;
&lt;td&gt;294&lt;/td&gt;
&lt;td&gt;454&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E142&lt;/td&gt;
&lt;td&gt;grouping by elements of a nested array&lt;/td&gt;
&lt;td&gt;580&lt;/td&gt;
&lt;td&gt;842&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;E089 is slow on purpose, on both sides: every node is saved by a separate call, &lt;code&gt;CreateChildAsync&lt;/code&gt; in redb and &lt;code&gt;SaveChangesAsync&lt;/code&gt; in EF. It shows what a single save costs and serves as the baseline for the right way, a bulk insert (E088). There redb is faster: 77 ms against 218.&lt;/p&gt;

&lt;p&gt;Eight more examples go to EF: &lt;code&gt;AnyAsync&lt;/code&gt; with a condition, a tree count and a simple tree query, a sum over a top-level field, an average over a base field, a sum with a filter, an object without props and a mixed batch. Thirteen more are about even: &lt;code&gt;CountAsync&lt;/code&gt;, &lt;code&gt;AnyAsync&lt;/code&gt;, &lt;code&gt;AllAsync&lt;/code&gt;, a projection, &lt;code&gt;Min&lt;/code&gt; and &lt;code&gt;Max&lt;/code&gt;, a sum over a base field, grouping with a filter, aggregates with a filter, a condition on a field and an array at once, moving a node and tree selections.&lt;/p&gt;

&lt;p&gt;The mechanism is the same everywhere. A flat table keeps an employee's fields in one row and an array in one child table. Creating a tree node is one insert into one table; computing an average is one pass over a narrow column. In redb an object is an object row plus a row per field, an array is a row per element, and an aggregate first selects the objects of the scheme, then reads the values of another field and joins them by object. When the graph is not needed, that work gives nothing back.&lt;/p&gt;

&lt;p&gt;It is telling how the picture changes once a nested field enters the aggregate. An average over a base field is faster in EF (E145: 30 ms against 50). A batch of aggregates that includes &lt;code&gt;HomeAddress.Building.Floor&lt;/code&gt; (E127) needs joins to the address and building tables in EF, and the result flips: 136 ms in redb against 426 in EF.&lt;/p&gt;

&lt;h2&gt;
  
  
  The props cache: when you need it
&lt;/h2&gt;

&lt;p&gt;redb has an object cache in process memory. It holds a whole &lt;code&gt;RedbObject&lt;/code&gt; with its Props, keyed by object id, and serves it only if the row hash in the database has not changed. An object from a list, whose hash arrives with the row, is served with no extra query; &lt;code&gt;LoadAsync&lt;/code&gt; by id makes one short hash check and takes the graph from memory. When the object changes in the database, its hash changes, and the next read loads it again.&lt;/p&gt;

&lt;p&gt;That makes it clear where the cache pays off: many reads of the same objects, which also change. Reference data, cards, active orders, anything the application rereads all the time. For such a load you do not need to stand up Redis and keep it consistent with the database yourself: the hash check is built in. Each process has its own cache, not shared between nodes; the same hash check keeps a cluster correct.&lt;/p&gt;

&lt;p&gt;Where the cache does not pay off is visible in the published run as well. On PostgreSQL the third run, reading through the filled cache, is faster than the repeat by more than 1.25x in 22 examples out of 152, within noise in 128, and slower in two. Queries that pick new objects every time get nothing from the cache, and on very short queries the hash check can add milliseconds.&lt;/p&gt;

&lt;p&gt;Settings in &lt;code&gt;RedbServiceConfiguration&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Setting&lt;/th&gt;
&lt;th&gt;Default&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;EnablePropsCache&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;turn the cache on&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;PropsCacheMaxSize&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;10,000&lt;/td&gt;
&lt;td&gt;entry limit; one entry is one object, and an object with nested references to other objects takes several entries&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;PropsCacheTtl&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;60 minutes&lt;/td&gt;
&lt;td&gt;entry lifetime from the moment it was put in the cache&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Eviction is least recently used: when the entry count goes over the limit, the least recently read tenth goes at once. If eviction is frequent, the cache idles: it spends memory and hardly ever hits.&lt;/p&gt;

&lt;p&gt;How to size it. Count not the objects that change but the ones read within one entry lifetime, together with the objects they reference. For example, if about 10k objects change per day and reads reach noticeably wider, 100k entries is a sensible starting point, and &lt;code&gt;PropsCacheTtl&lt;/code&gt; should then go from one hour to a working day. From there, observation decides: &lt;code&gt;GetStats()&lt;/code&gt; on the cache reports entries, hits, misses and hit rate, and the log shows a "Props cache is full" warning when more than a fifth of the limit is evicted within 10 seconds. Frequent warnings mean one of two things: raise the limit or turn the cache off.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequent changes: database maintenance
&lt;/h2&gt;

&lt;p&gt;Changing an object in redb rewrites value rows: by default by delete and insert, while the &lt;code&gt;ChangeTracking&lt;/code&gt; strategy in Pro writes only the values that changed. The value columns are indexed, so PostgreSQL can almost never update a row in place (HOT): an audit of a production database counted 790k updates of the value table in 9.5 hours, three of them HOT. The result is dead rows and index bloat. This is not a redb trait but ordinary PostgreSQL hygiene for any table with frequent changes to indexed columns.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PostgreSQL.&lt;/strong&gt; The stock autovacuum threshold, 20% of the table's rows (&lt;code&gt;autovacuum_vacuum_scale_factor = 0.2&lt;/code&gt;), means millions of dead rows before the first vacuum on a 38-million-row value table. It is worth lowering that threshold for the value table specifically. Bloated indexes are found with &lt;code&gt;pgstatindex&lt;/code&gt; and rebuilt with &lt;code&gt;REINDEX INDEX CONCURRENTLY&lt;/code&gt;, without blocking writes. In one of our production projects this is a nightly job on the application side: &lt;code&gt;VACUUM (ANALYZE)&lt;/code&gt; of the value and object tables, then a rebuild of every B-tree index with more than 30% empty leaf space, smallest first, under an advisory lock so that two nodes never run the job at once. An interrupted &lt;code&gt;REINDEX CONCURRENTLY&lt;/code&gt; leaves an invalid &lt;code&gt;*_ccnew&lt;/code&gt; index, which the job logs for a manual drop. How much it matters: after this hygiene the production database shrank from 79 GB to 15 GB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SQL Server.&lt;/strong&gt; The same idea: a regular job that runs &lt;code&gt;ALTER INDEX ... REORGANIZE&lt;/code&gt; or &lt;code&gt;REBUILD&lt;/code&gt; depending on fragmentation, plus statistics updates.&lt;/p&gt;

&lt;p&gt;redb deliberately ships no vacuum or rebuild schedule: these decisions depend on data volume and belong to the database administrator. The provider sources on GitHub have an &lt;code&gt;sql/maintenance&lt;/code&gt; folder with scripts for one-off index operations.&lt;/p&gt;

&lt;p&gt;This hygiene applies to any database with frequent changes, PostgreSQL, SQL Server or another, with redb or without it. A detailed treatment is beyond the scope of this article; the topic is covered at length in database documentation and in administrators' write-ups.&lt;/p&gt;

&lt;h2&gt;
  
  
  Development speed
&lt;/h2&gt;

&lt;p&gt;The numbers above are about query time. For a business, developer time matters at least as much.&lt;/p&gt;

&lt;p&gt;In redb the model is a C# class. At start-up the database scheme is reconciled with the class: a new field, a removed field, a type change are applied automatically, with no migration files. Removing a field from the class removes it from the scheme together with its values; for rollouts where the old and new versions share the database, this is switched off (&lt;code&gt;DefaultStrictDeleteExtra = false&lt;/code&gt;). When the meaning of the data changes and not just its shape (a field split in two, values recalculated), Pro has data migrations, &lt;code&gt;IRedbMigration&amp;lt;T&amp;gt;&lt;/code&gt;. But most model edits need none of that.&lt;/p&gt;

&lt;p&gt;This is felt most while the business is still looking for the product's shape. The model changes daily: a field added to an order, an address moved into its own class, a string turned into a dictionary. In EF each such edit means a migration, applying and rolling it back, and edits to entities, &lt;code&gt;Include&lt;/code&gt; chains and mapping. In our example that is 54 entities, a 930-line context, 31 &lt;code&gt;Include&lt;/code&gt; calls and about 360 lines of mapping, all of which has to be kept consistent. In redb you edit one class and work with it as a business object right away.&lt;/p&gt;

&lt;p&gt;Projections are there too: &lt;code&gt;Select&lt;/code&gt; takes fields at any depth, dictionary entries included, and the server reads only those (shortened from example E075):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;redb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Query&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;EmployeeProps&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Salary&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;60000m&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;HomeAddress&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Building&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Floor&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;OrderByDescending&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Salary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Take&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;FirstName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Salary&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nc"&gt;HomeCity&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;HomeAddress&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;City&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nc"&gt;HomeFloor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;HomeAddress&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Building&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Floor&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nc"&gt;HqCity&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;OfficeLocations&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"HQ"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;City&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ToListAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To be fair: EF does not lose on projections, it is one select over a few columns, and in the run E075 is even (271 ms for EF, 292 for redb). redb's gain here is not speed but that the projection is written against the same business class, without knowing which of the 54 tables holds the field.&lt;/p&gt;

&lt;p&gt;What the team gets in the end:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The model is one class.&lt;/strong&gt; No &lt;code&gt;DbContext&lt;/code&gt;, no Fluent API, no entity per collection.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A schema without migration files.&lt;/strong&gt; New and removed fields and type changes are applied at start-up.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A business object straight away.&lt;/strong&gt; &lt;code&gt;LoadAsync&lt;/code&gt; and &lt;code&gt;Query&amp;lt;T&amp;gt;().ToListAsync()&lt;/code&gt; return &lt;code&gt;RedbObject&amp;lt;T&amp;gt;&lt;/code&gt; with the whole graph, with no &lt;code&gt;Include&lt;/code&gt; and no mapping.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LINQ at any depth.&lt;/strong&gt; Filters, sorts and projections over nested classes, arrays and dictionaries are plain C# expressions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trees out of the box.&lt;/strong&gt; Object hierarchies and queries over them (&lt;code&gt;TreeQuery&lt;/code&gt;, &lt;code&gt;WhereHasAncestor&lt;/code&gt;, &lt;code&gt;WhereHasDescendant&lt;/code&gt;), with depth as a parameter.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What plain EF Core LINQ does not have.&lt;/strong&gt; 45 of the 155 EF twins stayed N/A: tree queries of any depth (17 examples), window functions &lt;code&gt;RANK&lt;/code&gt;, &lt;code&gt;ROW_NUMBER&lt;/code&gt;, &lt;code&gt;LAG&lt;/code&gt;/&lt;code&gt;LEAD&lt;/code&gt;, &lt;code&gt;NTILE&lt;/code&gt;, running sums (11 examples), soft delete into a trash that releases unique keys, unique keys over the content of a nested class, a subtree or list elements.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No workarounds.&lt;/strong&gt; The EF twins needed &lt;code&gt;OrderBy(_id)&lt;/code&gt; in 54 examples only so that &lt;code&gt;Take&lt;/code&gt; with split queries would not lose graph children; &lt;code&gt;DISTINCT ON&lt;/code&gt; had to be emulated by grouping and a second load. redb needs neither.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analytics in LINQ.&lt;/strong&gt; &lt;code&gt;GroupBy&lt;/code&gt; with keys from nested fields and list items, grouping by elements of arrays at any depth (&lt;code&gt;GroupByArray&lt;/code&gt;), &lt;code&gt;WithWindow&lt;/code&gt; windows with &lt;code&gt;Win.RowNumber&lt;/code&gt;, &lt;code&gt;Rank&lt;/code&gt;, &lt;code&gt;Lag&lt;/code&gt;, &lt;code&gt;Lead&lt;/code&gt;, &lt;code&gt;Ntile&lt;/code&gt;, a batch of aggregates in one pass (&lt;code&gt;AggregateAsync&lt;/code&gt;); all of it works over a tree as well.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Indexes out of the box.&lt;/strong&gt; For EF the filter indexes were picked by hand; redb ships with its own and updates them itself when its database module version changes, and Pro adds the streams indexes at start-up.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SQL visible before it runs.&lt;/strong&gt; &lt;code&gt;ToSqlStringAsync()&lt;/code&gt; shows the text of a query, grouping or window, and in Pro the planner's decision as comments too.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Observability.&lt;/strong&gt; Every database command is its own OpenTelemetry span from &lt;code&gt;RedbActivitySource&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Several nodes at start-up.&lt;/strong&gt; The schema is created and upgraded under a lock, once, even when nodes start together.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One model, three databases.&lt;/strong&gt; PostgreSQL, SQL Server and SQLite with the same application code; &lt;code&gt;redb export&lt;/code&gt; and &lt;code&gt;redb import&lt;/code&gt; move a whole database between them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A relational copy on demand.&lt;/strong&gt; &lt;code&gt;redb flat&lt;/code&gt; unfolds the data into normal form for reports and analytics.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What to choose
&lt;/h2&gt;

&lt;p&gt;The numbers lead to a simple rule.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;redb where the object is a graph.&lt;/strong&gt; An order with line items, addresses and status history. A customer card with contacts, documents and a dictionary of attributes. A route with stops, cargo and trips. In normal form such objects scatter over dozens of tables, and every read reassembles them. redb keeps the graph in two tables, reads it in bulk and changes the schema together with the class, without migrations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EF Core and a flat table where the data is flat.&lt;/strong&gt; Logs, events, sensor readings, time series: many rows with a few scalar fields, bulk writes and aggregates over columns. You can store that in redb, but it is an antipattern: every log row becomes an object row plus a row per field, writes and storage multiply, and there is no graph to gain from.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Together.&lt;/strong&gt; redb needs no separate database and does not compete with EF for the model. Graph objects live in redb, logs and trends in ordinary tables next to them, in the same database. And if a graph has to go to reports or analytics in relational shape, &lt;code&gt;redb flat&lt;/code&gt; unfolds it into normal form, data included.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;The comparison on 100k employees showed two things, and both are honest. On complex graphs redb Pro is an order of magnitude faster than EF Core: the median by 7.7-13x, individual queries by tens and hundreds of times. On flat data and scalar aggregates EF Core is faster, sometimes by several times.&lt;/p&gt;

&lt;p&gt;redb Pro's speed on graphs rests on three things: the graph is stored in two tables and read in bulk, field queries run as streams instead of folding everything, and "structure, value, object" indexes let a narrow condition or a page start in the right place. All the numbers of the run are published on &lt;a href="https://redbase.app/results" rel="noopener noreferrer"&gt;redbase.app/results&lt;/a&gt;. The examples, the EF twins and the flat schema are in the open repository, and the run can be repeated on your own hardware. redb Pro costs nothing for that: on the 3.x and 4.x lines the packages are free and need no key, commercial production use included.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;If this was useful, a ⭐ on &lt;a href="https://github.com/redbase-app" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; helps others find it.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;More of my writing: &lt;a href="https://redbase.app/articles" rel="noopener noreferrer"&gt;redbase.app/articles&lt;/a&gt;, and on &lt;a href="https://dev.to/rinat_kozin"&gt;dev.to&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>efcore</category>
      <category>postgres</category>
      <category>performance</category>
    </item>
    <item>
      <title>AS4 in .NET without a Java MSH: ebMS 3.0, WS-Security and non-repudiation receipts as a route step</title>
      <dc:creator>rinat kozin</dc:creator>
      <pubDate>Thu, 01 Oct 2026 14:42:55 +0000</pubDate>
      <link>https://dev.to/rinat_kozin/as4-in-net-without-a-java-msh-ebms-30-ws-security-and-non-repudiation-receipts-as-a-route-step-15lj</link>
      <guid>https://dev.to/rinat_kozin/as4-in-net-without-a-java-msh-ebms-30-ws-security-and-non-repudiation-receipts-as-a-route-step-15lj</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvl49gw9u9fkw627wewwa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvl49gw9u9fkw627wewwa.png" alt="redb.Route.AS4" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AS4 brings signed, encrypted document exchange to EU government and enterprise networks, now as a native &lt;strong&gt;redb.Route&lt;/strong&gt; connector with no Java MSH or gateway.&lt;/p&gt;

&lt;p&gt;If you want a homely analogy, AS4 is a registered letter with a delivery receipt, except the document itself travels over the network instead of on paper. You send it to a partner; the partner acknowledges receipt. The difference from post is that a paper receipt proves only that the envelope arrived, while an AS4 receipt is cryptographically bound to the content: it proves that this exact document arrived, byte for byte.&lt;/p&gt;

&lt;p&gt;If you exchange documents with European B2B, you almost certainly already run AS4. It is the OASIS ebMS 3.0 profile that stands behind EU eDelivery: legal documents in e-CODEX and e-Justice, electronic invoices on the Peppol network, gas operators' requests in ENTSOG, electronic transport documents in eFTI. AS4 is the direct successor to AS2, except that where AS2 carried an S/MIME envelope, this wire carries SOAP 1.2 with an &lt;code&gt;eb:Messaging&lt;/code&gt; header, WS-Security and a signed receipt. Where AS2 returned an MDN with a MIC, AS4 returns an &lt;code&gt;eb:Receipt&lt;/code&gt; with non-repudiation: proof that your partner received exactly the document you signed.&lt;/p&gt;

&lt;p&gt;In .NET this world has been badly served. The mature AS4 implementations live in Java: Holodeck B2B, Apache Domibus (the reference EU eDelivery access point), phase4. So next to your .NET backend you run either a separate JVM process or a commercial gateway with its own license, its own inbox directory and its own ops team. The base .NET stack does not cover AS4: no SOAP envelope with ebMS headers, no WS-Security over MIME attachments, no receipt you can actually point to.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;redb.Route.As4&lt;/code&gt; puts AS4 inside the route. Sending is a &lt;code&gt;To&lt;/code&gt; step; receiving is a &lt;code&gt;From&lt;/code&gt; step. The document is assembled, compressed, signed and encrypted, sent to the partner, and a verified receipt comes back. Or the other way around: the envelope arrives, is decrypted, the signature verifies, the document lands in the route and a receipt goes back to the partner. One process, one deployment, one trace tree. Below: what it looks like in code, and where the real difficulty actually lies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why AS4, and not "just HTTPS"
&lt;/h2&gt;

&lt;p&gt;Fair question: if the channel is already under TLS, why also sign and encrypt the document on top? The answer is the same as in the AS2 world, and it is not paranoia. TLS protects the channel: it lives from your socket to the partner's socket and ends the moment the bytes hit disk. In a load balancer's log, in a proxy's archive, on the recipient's filesystem, the document is already in the clear. AS4 protects the document itself: it stays signed and encrypted the whole way and at rest, and only the holder of the private key can decrypt it.&lt;/p&gt;

&lt;p&gt;The bigger point is the receipt. TLS has none. AS4 does: the receiver answers with a signed receipt whose non-repudiation references point at exactly what you signed. That is non-repudiation. When a document carries money, deadlines or a legal obligation, you do not just need to know it was delivered, you need proof that this exact document was delivered. That is why AS4 is mandatory wherever the document is a legal commitment and not a letter.&lt;/p&gt;

&lt;h2&gt;
  
  
  AS4 in one minute
&lt;/h2&gt;

&lt;p&gt;On the wire it is an HTTP POST with &lt;code&gt;multipart/related&lt;/code&gt; and SOAP 1.2. The envelope has two parts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The header.&lt;/strong&gt; &lt;code&gt;eb:Messaging&lt;/code&gt; carries the business metadata: &lt;code&gt;eb:UserMessage&lt;/code&gt; with the message id, the parties (&lt;code&gt;eb:PartyId&lt;/code&gt;), the service and action (&lt;code&gt;eb:Service&lt;/code&gt;, &lt;code&gt;eb:Action&lt;/code&gt;), and the four mandatory four-corner properties (&lt;code&gt;originalSender&lt;/code&gt;, &lt;code&gt;finalRecipient&lt;/code&gt;). Next to it sits the &lt;code&gt;wsse:Security&lt;/code&gt; block: &lt;code&gt;wsu:Timestamp&lt;/code&gt;, the sender's certificate (&lt;code&gt;wsse:BinarySecurityToken&lt;/code&gt;), the encrypted session key (&lt;code&gt;xenc:EncryptedKey&lt;/code&gt;), the signature (&lt;code&gt;ds:Signature&lt;/code&gt;) and one &lt;code&gt;xenc:EncryptedData&lt;/code&gt; per encrypted attachment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The attachments.&lt;/strong&gt; The business document is not in the SOAP body; it travels as separate MIME parts (SOAP with Attachments, SwA). A part is gzipped, then encrypted, then the whole message is signed. The SOAP body is usually empty. This is the key difference from our SOAP connector, which speaks MTOM: in AS4 the payload always rides as an attachment.&lt;/p&gt;

&lt;p&gt;The receiver decrypts with its private key, verifies the signature against the sender's certificate, decompresses, and returns a signed receipt &lt;strong&gt;in the same HTTP response&lt;/strong&gt;. A synchronous receipt is mandatory in the eDelivery AS4 profile: the sender waits for it immediately, not in a separate request.&lt;/p&gt;

&lt;h2&gt;
  
  
  A readable route: the endpoint is a string
&lt;/h2&gt;

&lt;p&gt;redb.Route is &lt;a href="https://redbase.app/articles" rel="noopener noreferrer"&gt;Apache Camel for .NET&lt;/a&gt;: a route reads &lt;code&gt;From → … → To&lt;/code&gt;, and an endpoint is a URI string. The AS4 connector adds two schemes, &lt;code&gt;as4&lt;/code&gt; (HTTP) and &lt;code&gt;as4s&lt;/code&gt; (HTTPS), and they read like a sentence:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;as4s://ap.partner.example/as4?connectionFactory=node&amp;amp;partner=acme   # where we send to
as4:/as4/in?host=0.0.0.0&amp;amp;port=4090&amp;amp;connectionFactory=node           # where we listen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The string states the intent up front: where we go, which port we listen on, which node and partner. There is a fluent builder too, and it compiles to the same URI, so an endpoint address can live in &lt;code&gt;appsettings.json&lt;/code&gt; and move between environments without touching code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddRedbRoute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;route&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;route&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddRedbRouteAs4&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="n"&gt;route&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AddRouteBuilder&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;MyRoutes&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;();&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;AddRedbRouteAs4()&lt;/code&gt; registers the schemes. The receive side runs on the shared Kestrel host that every HTTP-based connector in the process uses: an HTTP, SOAP, AS2 and AS4 route in one worker never fight over a port, each one listens on its own path. Certificates, passwords and algorithms do not live in the URI, because the URI is the route key and ends up in logs, traces and the dashboard. Everything secret goes into a separate object.&lt;/p&gt;

&lt;p&gt;The same integration can be written as Route-XML instead of code: endpoints in &lt;code&gt;.route.xml&lt;/code&gt; files, the node and partners in &lt;code&gt;&amp;lt;bean&amp;gt;&lt;/code&gt;. It is pleasant to write in VS Code with the &lt;code&gt;redb-route-xml&lt;/code&gt; extension: completion and validation against the schema, a route tree, a step graph. The extension is not on the Marketplace; it ships as a file with every release. Download &lt;code&gt;redb-route-xml-&amp;lt;version&amp;gt;.vsix&lt;/code&gt; from the releases page and install it through "Extensions → … → Install from VSIX" or with &lt;code&gt;code --install-extension redb-route-xml-&amp;lt;version&amp;gt;.vsix&lt;/code&gt; (VS Code usually pulls in the base Red Hat XML extension on its own). Below, every C# example is paired with its XML equivalent, and full markup examples live in the repository: &lt;code&gt;demos/XmlDemo&lt;/code&gt; and &lt;code&gt;demos/SerialNumbersDemo/SerialNumbers.Xml&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The node and its partners: one object, not a scatter of parameters
&lt;/h2&gt;

&lt;p&gt;In AS4 everything hangs off the agreement (the P-Mode): who, what, to whom, with which algorithms, whether a receipt is required. With us the agreement is a typed object in the registry. Our node (&lt;code&gt;As4ConnectionFactory&lt;/code&gt;) knows our identity, our keys and the list of partners; each partner (&lt;code&gt;As4Partner&lt;/code&gt;) is one agreement.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddToRegistry&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"node"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;As4ConnectionFactory&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;OurPartyId&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"urn:oasis:names:tc:ebcore:partyid-type:unregistered:us"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ExternalHostName&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"ap.us.example"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;        &lt;span class="c1"&gt;// host in our eb:MessageId, not the machine name&lt;/span&gt;
    &lt;span class="n"&gt;SigningCertificate&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ourPfx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;               &lt;span class="c1"&gt;// our key: signs outgoing messages and receipts&lt;/span&gt;
    &lt;span class="n"&gt;DecryptionCertificates&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;ourPfx&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;       &lt;span class="c1"&gt;// our keys: decrypt what partners encrypt for us&lt;/span&gt;
    &lt;span class="n"&gt;Partners&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;As4Partner&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"acme"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;PartyId&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"urn:oasis:names:tc:ebcore:partyid-type:unregistered:acme"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;Service&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"urn:example:services:invoice"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;Action&lt;/span&gt;  &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Submit"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;PartnerSigningCertificates&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;acmeCer&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;   &lt;span class="c1"&gt;// verifies the partner's signature&lt;/span&gt;
            &lt;span class="n"&gt;PartnerEncryptionCertificate&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;acmeCer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;     &lt;span class="c1"&gt;// encrypts payloads for the partner&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A route refers to the node by name (&lt;code&gt;connectionFactory=node&lt;/code&gt;) and, when sending, to the partner (&lt;code&gt;partner=acme&lt;/code&gt;). The receive endpoint does not name a partner: one receive URL accepts every partner of the node, and the connector tells the sender apart from the envelope itself. A certificate in the list is not "validity in general": a signature is accepted only from a partner certificate and only if it covers what the profile requires. Key rotation is a list of several certificates, not a stop in the exchange.&lt;/p&gt;

&lt;p&gt;The same node and partner in markup (&lt;code&gt;context.xml&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;context&lt;/span&gt; &lt;span class="na"&gt;xmlns=&lt;/span&gt;&lt;span class="s"&gt;"urn:redb:route:1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;bean&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"acme"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"redb.Route.As4.As4Partner, redb.Route.As4"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;property&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"Name"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"acme"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;property&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"PartyId"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"urn:oasis:names:tc:ebcore:partyid-type:unregistered:acme"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;property&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"Service"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"urn:example:services:invoice"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;property&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"Action"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"Submit"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;property&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"PartnerSigningCertificates"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;list&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;bean&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"System.Security.Cryptography.X509Certificates.X509CertificateLoader, System.Security.Cryptography"&lt;/span&gt;
              &lt;span class="na"&gt;factoryMethod=&lt;/span&gt;&lt;span class="s"&gt;"LoadCertificateFromFile"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;constructorArg&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"{{as4.certificates}}/acme.cer"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/bean&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/list&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;property&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"PartnerEncryptionCertificate"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;bean&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"System.Security.Cryptography.X509Certificates.X509CertificateLoader, System.Security.Cryptography"&lt;/span&gt;
            &lt;span class="na"&gt;factoryMethod=&lt;/span&gt;&lt;span class="s"&gt;"LoadCertificateFromFile"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;constructorArg&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"{{as4.certificates}}/acme.cer"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/bean&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/bean&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;bean&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"node-key"&lt;/span&gt;
        &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"System.Security.Cryptography.X509Certificates.X509CertificateLoader, System.Security.Cryptography"&lt;/span&gt;
        &lt;span class="na"&gt;factoryMethod=&lt;/span&gt;&lt;span class="s"&gt;"LoadPkcs12FromFile"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;constructorArg&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"{{as4.certificates}}/us.pfx"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;constructorArg&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"{{as4.password}}"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/bean&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;bean&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"node"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"redb.Route.As4.As4ConnectionFactory, redb.Route.As4"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;property&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"OurPartyId"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"urn:oasis:names:tc:ebcore:partyid-type:unregistered:us"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;property&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"ExternalHostName"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"ap.us.example"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;property&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"SigningCertificate"&lt;/span&gt; &lt;span class="na"&gt;ref=&lt;/span&gt;&lt;span class="s"&gt;"node-key"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;property&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"DecryptionCertificates"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;list&amp;gt;&amp;lt;ref&lt;/span&gt; &lt;span class="na"&gt;bean=&lt;/span&gt;&lt;span class="s"&gt;"node-key"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&amp;lt;/list&amp;gt;&amp;lt;/property&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;property&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"Partners"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;list&amp;gt;&amp;lt;ref&lt;/span&gt; &lt;span class="na"&gt;bean=&lt;/span&gt;&lt;span class="s"&gt;"acme"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&amp;lt;/list&amp;gt;&amp;lt;/property&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/bean&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;bean&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"as4-in"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"redb.Route.Processors.InMemoryIdempotentRepository, redb.Route"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/context&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Sending: compress, encrypt, sign, wait for the receipt
&lt;/h2&gt;

&lt;p&gt;Sending is a &lt;code&gt;To&lt;/code&gt; step. The body becomes a single attachment: a &lt;code&gt;byte[]&lt;/code&gt; as is, a &lt;code&gt;string&lt;/code&gt; in UTF-8, a &lt;code&gt;Stream&lt;/code&gt; copied through.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;redb.Route.As4.Fluent&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nf"&gt;From&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"direct://outbound"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;SetHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;As4Headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;OriginalSender&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"urn:example:c1"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;// four corners: the original sender&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;SetHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;As4Headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;FinalRecipient&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"urn:example:c4"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;// and the final recipient&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;To&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;As4&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"https://ap.acme.example/as4"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
             &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ConnectionFactory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"node"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
             &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Partner&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"acme"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Behind that one &lt;code&gt;To&lt;/code&gt; line: gzip, encryption with the partner's key, a signature with your key, the POST and the parsing of the response. The producer waits for the receipt and checks it: signed by a partner certificate and referencing exactly the digests we signed. The result lands on &lt;code&gt;exchange.Out&lt;/code&gt;, so the route can decide:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Header on &lt;code&gt;exchange.Out&lt;/code&gt;
&lt;/th&gt;
&lt;th&gt;What it means&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;redbAs4.receiptValid&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;bool&lt;/code&gt;: the receipt arrived and verified, non-repudiation included&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;redbAs4.receiptMessageId&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;the &lt;code&gt;eb:MessageId&lt;/code&gt; of the receipt itself&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;redbAs4.messageId&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;the &lt;code&gt;eb:MessageId&lt;/code&gt; of the message we sent&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Exceptions instead of hand-parsing the response:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Outcome&lt;/th&gt;
&lt;th&gt;Exception&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;The partner answered with an ebMS error&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;As4ErrorSignalException&lt;/code&gt; (&lt;code&gt;ErrorCode&lt;/code&gt;, &lt;code&gt;Description&lt;/code&gt;, &lt;code&gt;ErrorDetail&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No receipt in the response, or no response within &lt;code&gt;timeout&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;As4ReceiptException&lt;/code&gt; (&lt;code&gt;EBMS:0301&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A receipt with someone else's signature or different digests&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;As4ReceiptException&lt;/code&gt; (&lt;code&gt;EBMS:0302&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The same sending route in markup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- routes/outbox.route.xml --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;routes&lt;/span&gt; &lt;span class="na"&gt;xmlns=&lt;/span&gt;&lt;span class="s"&gt;"urn:redb:route:1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;route&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"as4-outbox"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;from&lt;/span&gt; &lt;span class="na"&gt;uri=&lt;/span&gt;&lt;span class="s"&gt;"direct://outbound"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;setHeader&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"redbAs4.property.originalSender"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"urn:example:c1"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;setHeader&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"redbAs4.property.finalRecipient"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"urn:example:c4"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;to&lt;/span&gt; &lt;span class="na"&gt;uri=&lt;/span&gt;&lt;span class="s"&gt;"as4s://ap.acme.example/as4?connectionFactory=node&amp;amp;amp;partner=acme"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/route&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/routes&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Receiving: decrypt, verify, hand to the route, answer with a receipt
&lt;/h2&gt;

&lt;p&gt;Receiving is a &lt;code&gt;From&lt;/code&gt; step, which is to say a route source.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="nf"&gt;From&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;As4&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Receive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/as4/in"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;Host&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"0.0.0.0"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;Port&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;4090&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ConnectionFactory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"node"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;IdempotentRepository&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"as4-in"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ValidateXsd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;invoiceSchema&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;          &lt;span class="c1"&gt;// validate the business document against its XSD&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;To&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"direct://process-invoice"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The arriving envelope is decrypted, its signature verified, decompressed and matched to a partner, and what lands in the route is a &lt;strong&gt;clean business document&lt;/strong&gt; with the right &lt;code&gt;Message.ContentType&lt;/code&gt; (say &lt;code&gt;application/xml&lt;/code&gt; or &lt;code&gt;application/edi-x12&lt;/code&gt;), not a transport wrapper. The exchange metadata lives under &lt;code&gt;redbAs4.*&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Header&lt;/th&gt;
&lt;th&gt;What it means&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;redbAs4.partner&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;the partner the message was matched to&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;redbAs4.signatureValid&lt;/code&gt; / &lt;code&gt;signerThumbprint&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;the signature verified against the partner certificate; its thumbprint&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;redbAs4.fromPartyId&lt;/code&gt; / &lt;code&gt;toPartyId&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;the parties of the message&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;redbAs4.service&lt;/code&gt; / &lt;code&gt;action&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;the business operation from &lt;code&gt;eb:CollaborationInfo&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;redbAs4.messageId&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;the &lt;code&gt;eb:MessageId&lt;/code&gt; of the incoming message&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;One detail matters here. The receipt goes back to the partner &lt;strong&gt;after&lt;/strong&gt; the route has run. If your &lt;code&gt;To&lt;/code&gt; failed and the transaction rolled back, there will be no successful receipt, because otherwise you would have acknowledged a document you did not store. A failed route becomes an ebMS error (&lt;code&gt;EBMS:0004&lt;/code&gt;), and the sender retries the delivery.&lt;/p&gt;

&lt;p&gt;The same receiving route in markup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- routes/inbox.route.xml --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;routes&lt;/span&gt; &lt;span class="na"&gt;xmlns=&lt;/span&gt;&lt;span class="s"&gt;"urn:redb:route:1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;route&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"as4-inbox"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;from&lt;/span&gt; &lt;span class="na"&gt;uri=&lt;/span&gt;&lt;span class="s"&gt;"as4:/as4/in?host=0.0.0.0&amp;amp;amp;port=4090&amp;amp;amp;connectionFactory=node&amp;amp;amp;idempotentRepository=as4-in"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;validateXsd&lt;/span&gt; &lt;span class="na"&gt;file=&lt;/span&gt;&lt;span class="s"&gt;"invoice.xsd"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;to&lt;/span&gt; &lt;span class="na"&gt;uri=&lt;/span&gt;&lt;span class="s"&gt;"direct://process-invoice"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/route&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/routes&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Reliability from the engine: duplicates and redelivery of the same message
&lt;/h2&gt;

&lt;p&gt;The profile requires duplicate detection, reliable messaging (Reception Awareness) and retries. In redb.Route none of that is written again: the connector stands on the engine's existing machinery and invents no retry loop, no duplicate store and no counter of its own.&lt;/p&gt;

&lt;p&gt;On receive, &lt;code&gt;idempotentRepository&lt;/code&gt; is mandatory. The &lt;code&gt;eb:MessageId&lt;/code&gt; of an incoming message is claimed only after every security check (a forged message cannot take the id of a real one), confirmed when the route succeeds and released when it fails. A duplicate arrives: the partner gets the receipt again, but the message is not delivered to the route a second time. The store comes in flavours, and the choice decides what survives a restart. &lt;code&gt;InMemoryIdempotentRepository&lt;/code&gt; forgets everything on restart and cannot see a duplicate that arrives on another node behind a load balancer; for production there is a redb or SQL store. The deduplication window is the store's &lt;code&gt;Ttl&lt;/code&gt;, and it must be longer than the sender's whole retry schedule.&lt;/p&gt;

&lt;p&gt;On send, a retry is &lt;code&gt;OnException&lt;/code&gt;. The producer sets &lt;code&gt;redbAs4.messageId&lt;/code&gt; on the exchange before the first attempt and keeps the signed request on the exchange: a redelivery sends &lt;strong&gt;the same bytes&lt;/strong&gt;, the same id and the same signature. That is not pedantry, it is what the protocol asks for: in AS4 a redelivery is the same message. The partner recognises the duplicate and answers with the receipt it stored for the first transmission (Domibus does exactly this), and its digests point at the very signature we resent.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;OnException&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;As4ReceiptException&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;MaximumRedeliveries&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;RedeliveryDelay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;TimeSpan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;FromSeconds&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;30&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;UseExponentialBackOff&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Handled&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;To&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"direct://as4-undelivered"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;          &lt;span class="c1"&gt;// dead letter after the last attempt&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same handler in markup (a file-level section, applying to every route in the file):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;onException&lt;/span&gt; &lt;span class="na"&gt;exceptions=&lt;/span&gt;&lt;span class="s"&gt;"redb.Route.As4.As4ReceiptException, redb.Route.As4"&lt;/span&gt;
             &lt;span class="na"&gt;handled=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt; &lt;span class="na"&gt;maximumRedeliveries=&lt;/span&gt;&lt;span class="s"&gt;"5"&lt;/span&gt; &lt;span class="na"&gt;redeliveryDelay=&lt;/span&gt;&lt;span class="s"&gt;"00:00:30"&lt;/span&gt;
             &lt;span class="na"&gt;exponentialBackOff=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;to&lt;/span&gt; &lt;span class="na"&gt;uri=&lt;/span&gt;&lt;span class="s"&gt;"direct://as4-undelivered"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/onException&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The engine's retry lives in memory: a restart loses the exchange it was retrying. For schedules measured in hours, hold the document in an outbox of your own (a redb object with the saved &lt;code&gt;redbAs4.messageId&lt;/code&gt;) and resend what still has no receipt from a &lt;code&gt;timer:&lt;/code&gt; route.&lt;/p&gt;

&lt;h2&gt;
  
  
  Streaming: huge documents are normal
&lt;/h2&gt;

&lt;p&gt;In B2B you meet attachments of hundreds of megabytes, and holding them whole in memory is not an option. An outgoing attachment is written to the wire through the core's stream cache: a large payload passes through a temporary file, not through a &lt;code&gt;byte[]&lt;/code&gt;. Compression and encryption are streamed (streamed AES-GCM on BouncyCastle), and an incoming attachment can be read as a stream (&lt;code&gt;streamBody&lt;/code&gt;) rather than a buffer expanded into memory.&lt;/p&gt;

&lt;p&gt;There are bounds, too: the request body size (&lt;code&gt;maxRequestBodySize&lt;/code&gt;, 100 MB by default), the SOAP envelope size (&lt;code&gt;maxEnvelopeCharacters&lt;/code&gt;, 1 MB; the payload rides as attachments and is not counted against it), and the partner's response size (&lt;code&gt;maxResponseBodySize&lt;/code&gt;, 4 MB; a receipt is kilobytes). A forward-only stream that cannot be reread is read once: to retry a send, cache it in the route with &lt;code&gt;.StreamCaching()&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The crypto layer we had to write ourselves
&lt;/h2&gt;

&lt;p&gt;This is where AS4 is genuinely hard, and why there is no mainstream .NET implementation. There was no built-in path, and not out of laziness: the API has specific gaps.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SignedXml&lt;/code&gt; in .NET cannot resolve &lt;code&gt;cid:&lt;/code&gt; references to MIME attachments. So the signature is handled by hand: the connector parses &lt;code&gt;ds:Reference&lt;/code&gt; and &lt;code&gt;SignedInfo&lt;/code&gt; itself, applies the Attachment-Content-Signature-Transform and Exclusive C14N (through the public &lt;code&gt;XmlDsigExcC14NTransform&lt;/code&gt;), and signs with RSA PKCS#1 v1.5.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;EncryptedXml&lt;/code&gt; in .NET cannot do AES-GCM, and its &lt;code&gt;DecryptKey&lt;/code&gt; supports only OAEP-SHA1, while the profile requires OAEP with MGF1-SHA256. So the session key is decrypted by hand, and the data is encrypted through &lt;code&gt;System.Security.Cryptography.AesGcm&lt;/code&gt; by the rules of XML Encryption 1.1 (a 12-byte IV, a 16-byte tag, order "IV, ciphertext, tag").&lt;/p&gt;

&lt;p&gt;Untrusted XML goes only through the core's &lt;code&gt;SafeXml&lt;/code&gt;: a DTD on input is refused (SOAP 1.2 itself does not allow one), and the envelope is size-limited. Against signed-element substitution (signature wrapping) the defence is that duplicate &lt;code&gt;wsu:Id&lt;/code&gt; values are rejected and every reference must cover &lt;code&gt;eb:Messaging&lt;/code&gt;, &lt;code&gt;soap:Body&lt;/code&gt;, each attachment and the &lt;code&gt;wsu:Timestamp&lt;/code&gt; when present. Against replay, a &lt;code&gt;wsu:Timestamp&lt;/code&gt; check by the WSS4J rules plus deduplication on &lt;code&gt;messageId&lt;/code&gt;. The text of decryption and signature errors never leaves: the detail goes to the log only, no oracle. Passwords are marked &lt;code&gt;[Sensitive]&lt;/code&gt; and redacted from logs and the dashboard.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 1.16 profile: what we accept, what we reject
&lt;/h2&gt;

&lt;p&gt;The connector implements the eDelivery AS4 1.16 profile and nothing beyond it. That is not a self-imposed limit, it is the reason it talks to real partners: the moment an implementation starts "guessing" at extensions, interop breaks.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What&lt;/th&gt;
&lt;th&gt;We accept&lt;/th&gt;
&lt;th&gt;Otherwise&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Signature&lt;/td&gt;
&lt;td&gt;RSA-SHA256&lt;/td&gt;
&lt;td&gt;the configuration is refused at startup; on input, &lt;code&gt;EBMS:0101&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Digest&lt;/td&gt;
&lt;td&gt;SHA-256&lt;/td&gt;
&lt;td&gt;the same&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Payload encryption&lt;/td&gt;
&lt;td&gt;AES-128-GCM&lt;/td&gt;
&lt;td&gt;at startup; on input, &lt;code&gt;EBMS:0102&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Key transport&lt;/td&gt;
&lt;td&gt;RSA-OAEP, MGF1-SHA256&lt;/td&gt;
&lt;td&gt;at startup; on input, &lt;code&gt;EBMS:0102&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Canonicalization&lt;/td&gt;
&lt;td&gt;Exclusive C14N&lt;/td&gt;
&lt;td&gt;&lt;code&gt;EBMS:0101&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Key reference&lt;/td&gt;
&lt;td&gt;BST / IssuerSerial / KeyIdentifier (on input)&lt;/td&gt;
&lt;td&gt;BST by default on send&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;An unsigned or unencrypted message&lt;/td&gt;
&lt;td&gt;never&lt;/td&gt;
&lt;td&gt;&lt;code&gt;EBMS:0103&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A payload in the SOAP body&lt;/td&gt;
&lt;td&gt;never (attachments only)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;EBMS:0002&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Some of what the specification calls optional is simply out of scope: Pull and asynchronous receipts. The common 1.16 profile does not require them either; it states plainly that a synchronous receipt is mandatory and an asynchronous one must not be used.&lt;/p&gt;

&lt;h2&gt;
  
  
  Interop is proven, not claimed
&lt;/h2&gt;

&lt;p&gt;An AS4 connector that only talks to itself proves nothing. This one is tested against independent implementations, with no shared code, in both directions.&lt;/p&gt;

&lt;p&gt;Against Holodeck B2B 8.1.1: both directions, across the whole profile matrix, with signatures, encryption, compression and each of the three key-reference forms. Against Apache Domibus 5.1 (the reference EU eDelivery access point, on a Harmony AP 2.6.2 stand): also both ways. We send, Domibus accepts (&lt;code&gt;RECEIVED&lt;/code&gt;); Domibus sends, the route gets the document, and Domibus accepts our receipt (&lt;code&gt;ACKNOWLEDGED&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Interop also surfaced things that are invisible without a live partner. Domibus's &lt;code&gt;eDeliveryAS4Policy&lt;/code&gt; (Strict, without IncludeTimestamp) rejects &lt;code&gt;wsu:Timestamp&lt;/code&gt;, so by default the connector sets no timestamp, and turns it on when the partner's policy asks. And on a redelivery Domibus returns the receipt it stored for the first transmission: had we rebuilt the message with a fresh signature, its digests would not have matched. That is why a redelivery resends the same bytes. This is exactly the class of problem the specification text does not contain and that only interop finds.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it differs from a Java MSH or a gateway
&lt;/h2&gt;

&lt;p&gt;AS4 in a .NET project used to be closed two ways: a separate Java MSH (a Message Service Handler, the AS4 term for an access point) or a commercial gateway. The difference is not whether they "can" do it, the protocol is one. The difference is where AS4 lives relative to your logic.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Commercial gateway&lt;/th&gt;
&lt;th&gt;Java MSH (Domibus/Holodeck)&lt;/th&gt;
&lt;th&gt;redb.Route.As4&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Process&lt;/td&gt;
&lt;td&gt;a separate box&lt;/td&gt;
&lt;td&gt;a separate JVM beside&lt;/td&gt;
&lt;td&gt;your .NET process&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Received document&lt;/td&gt;
&lt;td&gt;in an inbox directory&lt;/td&gt;
&lt;td&gt;in an inbox directory&lt;/td&gt;
&lt;td&gt;a message in the route&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;How you get it&lt;/td&gt;
&lt;td&gt;a poller job&lt;/td&gt;
&lt;td&gt;a poller job&lt;/td&gt;
&lt;td&gt;straight into the pipeline&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deploy&lt;/td&gt;
&lt;td&gt;its own installation&lt;/td&gt;
&lt;td&gt;its own installation&lt;/td&gt;
&lt;td&gt;with your application&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Observability&lt;/td&gt;
&lt;td&gt;its own panel&lt;/td&gt;
&lt;td&gt;JVM logs&lt;/td&gt;
&lt;td&gt;the shared traces and statistics&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Further processing&lt;/td&gt;
&lt;td&gt;outside the gateway, by hand&lt;/td&gt;
&lt;td&gt;outside the server, by hand&lt;/td&gt;
&lt;td&gt;the same EIPs, in the same route&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;License&lt;/td&gt;
&lt;td&gt;commercial&lt;/td&gt;
&lt;td&gt;open&lt;/td&gt;
&lt;td&gt;open, no key&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A separate MSH is justified when the AS4 contour is deliberately kept in an isolated zone, say a DMZ run by another team. When the document ends up in your .NET backend anyway, an intermediate process is one more hop, one more directory and one more component in the audit scheme.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it is used
&lt;/h2&gt;

&lt;p&gt;AS4 is needed wherever a document carries an obligation and the channel is dictated by someone else. A few typical situations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Peppol and e-invoicing.&lt;/strong&gt; An electronic invoice on the Peppol network travels by AS4 between access points. If you build your own access point or receive invoices directly, AS4 becomes a route step rather than an external box: the invoice arrives, is parsed, validated against UBL/CII, and lands in the ERP.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EU government and legal documents (e-CODEX, e-Justice).&lt;/strong&gt; Court and legal documents between national systems travel by eDelivery AS4 with strict signature and non-repudiation requirements. Here the legal weight of the document is the point of the channel.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Energy (ENTSOG).&lt;/strong&gt; Requests, schedules and balancing documents between gas operators. The exchange is mandatory, the profile is strict, and the partners are other operators' nodes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Transport and customs (eFTI).&lt;/strong&gt; Electronic transport documents and customs papers. The same profile: signature, encryption, receipt.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enterprise exchange with an EU public buyer.&lt;/strong&gt; Tender, reporting and regulatory documents that European buyers and regulators require over eDelivery AS4.&lt;/p&gt;

&lt;p&gt;Across all of them one thing is the same: the document must arrive reliably and with proof, and then be processed in your system. That seam is what the connector closes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest limits
&lt;/h2&gt;

&lt;p&gt;Nothing is free, so it is better to say plainly what is not here yet.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pull (the receiver fetches the message itself) and asynchronous receipts are not implemented. The common 1.16 profile does not require them, but if a specific partner wants Pull, this is not there yet.&lt;/li&gt;
&lt;li&gt;eDelivery AS4 2.0 (elliptic curves instead of RSA-OAEP) is not supported. The connector targets the 1.x line, common profile 1.16.&lt;/li&gt;
&lt;li&gt;Dynamic partner discovery (Peppol SMP/SML) is a separate, system-level task. The connector takes the address and the certificate from the agreement; where you get them is up to your integration.&lt;/li&gt;
&lt;li&gt;TLS against a partner's MSH has not been exercised live: both interop stands ran plain HTTP, while TLS and mutual TLS are covered by loopback handshakes. With a real partner it is worth checking separately.&lt;/li&gt;
&lt;li&gt;The engine's retry lives in memory, so schedules measured in hours need an outbox (which is a route pattern, not the connector).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Do I need a Java MSH beside it?&lt;/strong&gt; No. It is a native .NET connector: &lt;code&gt;HttpClient&lt;/code&gt;, the shared Kestrel host and &lt;code&gt;System.Security.Cryptography&lt;/code&gt;. It is both the sender and the receive access point.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AS4 or AS2?&lt;/strong&gt; Whatever your partner requires. AS2 is S/MIME and MDN; AS4 is SOAP, WS-Security and an ebMS receipt. EU government and Peppol dictate AS4, while US retail and logistics are often AS2. We cover AS2 &lt;a href="https://redbase.app/articles/as2-edi" rel="noopener noreferrer"&gt;separately&lt;/a&gt;; both connectors live in one process and run side by side.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where do certificates go?&lt;/strong&gt; In &lt;code&gt;As4ConnectionFactory&lt;/code&gt; and &lt;code&gt;As4Partner&lt;/code&gt;, as &lt;code&gt;X509Certificate2&lt;/code&gt;. Passwords are marked &lt;code&gt;[Sensitive]&lt;/code&gt;, and there are no secrets in the URI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can one worker carry HTTP, SOAP, AS2 and AS4?&lt;/strong&gt; Yes. They receive on the shared Kestrel host, each route on its own path.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What if the partner answers with an error?&lt;/strong&gt; The producer throws &lt;code&gt;As4ErrorSignalException&lt;/code&gt; with the code and description; &lt;code&gt;OnException&lt;/code&gt; decides whether to retry or move to a dead letter.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Synchronous or asynchronous receipt?&lt;/strong&gt; Synchronous, in the same HTTP response. It is a requirement of the 1.16 profile, which is why &lt;code&gt;transacted&lt;/code&gt; is not allowed on a send: you cannot defer a synchronous receipt to the end of a transaction.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet add package redb.Route.As4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The package is &lt;a href="https://www.nuget.org/packages/redb.Route.As4/" rel="noopener noreferrer"&gt;redb.Route.As4 on NuGet&lt;/a&gt;; the source and the full DSL reference are in the &lt;a href="https://github.com/redbase-app/redb-route/tree/main/redb.Route.As4" rel="noopener noreferrer"&gt;connector README&lt;/a&gt;. AS4 is one more transport in the redb.Route family, alongside Kafka, RabbitMQ, AS2, IBM MQ and the rest: the same &lt;code&gt;From → … → To&lt;/code&gt;, the same EIPs, the same observability. The only difference is that the wire carries a SOAP envelope with ebMS headers, which a European access point is waiting for.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;If this was useful, a ⭐ on &lt;a href="https://github.com/redbase-app" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; helps others find it.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;More of my writing: redbase.app/articles, and on &lt;a href="https://dev.to/rinat_kozin"&gt;dev.to&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>csharp</category>
      <category>opensource</category>
      <category>as4</category>
    </item>
    <item>
      <title>Redis in .NET routes: cache, Pub/Sub, Streams with consumer groups and Claim Check in one connector</title>
      <dc:creator>rinat kozin</dc:creator>
      <pubDate>Wed, 23 Sep 2026 19:06:00 +0000</pubDate>
      <link>https://dev.to/rinat_kozin/redis-in-net-routes-cache-pubsub-streams-with-consumer-groups-and-claim-check-in-one-connector-5b5f</link>
      <guid>https://dev.to/rinat_kozin/redis-in-net-routes-cache-pubsub-streams-with-consumer-groups-and-claim-check-in-one-connector-5b5f</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkr32gahv9sm0n8h7u9qp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkr32gahv9sm0n8h7u9qp.png" alt="redb.Route.Redis" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Redis connector for &lt;strong&gt;redb.Route&lt;/strong&gt;: every data structure as a route step, Pub/Sub, Streams with consumer groups, a list as a queue, and Claim Check on Redis.&lt;/p&gt;

&lt;p&gt;In an integration project Redis is rarely just one thing. It caches answers from external systems, holds counters and locks, carries events over Pub/Sub, keeps a log of messages in Streams, and works as a job queue on a list. Usually each of those roles lives in its own piece of code, with its own connection, its own retries and its own logging.&lt;/p&gt;

&lt;p&gt;In redb.Route they all live in one connector, &lt;code&gt;redb.Route.Redis&lt;/code&gt;. Any Redis operation becomes a step of a route, and a subscription, a stream or a list becomes its input. The connection, the telemetry and the graceful shutdown are the ones every other connector uses. Underneath it is StackExchange.Redis 2.11.8.&lt;/p&gt;

&lt;p&gt;The consumers are described here as of version 4.1.0: pattern subscriptions, a stream without a group keeping a position of its own, claiming back stream entries that got stuck, and a reliable list queue all arrived in it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing the package, and the address
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet add package redb.Route.Redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddRedbRoute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;route&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;route&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddRedbRouteRedis&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="n"&gt;route&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AddRouteBuilder&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;OrderRoutes&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;();&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An endpoint address reads &lt;code&gt;redis:OPERATION:resource?parameters&lt;/code&gt;. The first path segment is the Redis operation (case does not matter), everything after the first colon is the key, the channel or the stream name. Colons inside a key are kept, so &lt;code&gt;redis:SET:session:42?ttl=300&lt;/code&gt; writes the key &lt;code&gt;session:42&lt;/code&gt; with a 300 second time to live.&lt;/p&gt;

&lt;p&gt;The fluent builder produces the same address, and the rest of this post uses it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;To&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"session:42"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;Ttl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;300&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;   &lt;span class="c1"&gt;// redis:SET:session:42?ttl=300&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Redis&lt;/code&gt; has ready factories for keys, Pub/Sub, streams and lists (&lt;code&gt;Set&lt;/code&gt;, &lt;code&gt;Get&lt;/code&gt;, &lt;code&gt;Incr&lt;/code&gt;, &lt;code&gt;Publish&lt;/code&gt;, &lt;code&gt;Subscribe&lt;/code&gt;, &lt;code&gt;XAdd&lt;/code&gt;, &lt;code&gt;XRead&lt;/code&gt;, &lt;code&gt;LPush&lt;/code&gt; and the rest). Any other operation comes from &lt;code&gt;Redis.Command(operation, key)&lt;/code&gt;, for example &lt;code&gt;Redis.Command("HSET", "customer:42").Field("email")&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Every data structure as a route step
&lt;/h2&gt;

&lt;p&gt;The producer covers the operations of all the main Redis structures:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Structure&lt;/th&gt;
&lt;th&gt;Operations&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Strings and keys&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;SET&lt;/code&gt;, &lt;code&gt;GET&lt;/code&gt;, &lt;code&gt;DEL&lt;/code&gt;, &lt;code&gt;EXISTS&lt;/code&gt;, &lt;code&gt;EXPIRE&lt;/code&gt;, &lt;code&gt;INCR&lt;/code&gt;, &lt;code&gt;DECR&lt;/code&gt;, &lt;code&gt;SETNX&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lists&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;LPUSH&lt;/code&gt;, &lt;code&gt;RPUSH&lt;/code&gt;, &lt;code&gt;LPOP&lt;/code&gt;, &lt;code&gt;RPOP&lt;/code&gt;, &lt;code&gt;LLEN&lt;/code&gt;, &lt;code&gt;LRANGE&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hashes&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;HSET&lt;/code&gt;, &lt;code&gt;HGET&lt;/code&gt;, &lt;code&gt;HMSET&lt;/code&gt;, &lt;code&gt;HMGET&lt;/code&gt;, &lt;code&gt;HGETALL&lt;/code&gt;, &lt;code&gt;HDEL&lt;/code&gt;, &lt;code&gt;HLEN&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sets&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;SADD&lt;/code&gt;, &lt;code&gt;SREM&lt;/code&gt;, &lt;code&gt;SMEMBERS&lt;/code&gt;, &lt;code&gt;SCARD&lt;/code&gt;, &lt;code&gt;SISMEMBER&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sorted sets&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ZADD&lt;/code&gt;, &lt;code&gt;ZREM&lt;/code&gt;, &lt;code&gt;ZRANGE&lt;/code&gt;, &lt;code&gt;ZCARD&lt;/code&gt;, &lt;code&gt;ZSCORE&lt;/code&gt;, &lt;code&gt;ZRANGEBYSCORE&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Geo&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;GEOADD&lt;/code&gt;, &lt;code&gt;GEODIST&lt;/code&gt;, &lt;code&gt;GEORADIUS&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HyperLogLog&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;PFADD&lt;/code&gt;, &lt;code&gt;PFCOUNT&lt;/code&gt;, &lt;code&gt;PFMERGE&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bitmaps&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;SETBIT&lt;/code&gt;, &lt;code&gt;GETBIT&lt;/code&gt;, &lt;code&gt;BITCOUNT&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Messaging&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;PUBLISH&lt;/code&gt;, &lt;code&gt;XADD&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Any command&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;COMMAND&lt;/code&gt;, with the command name in &lt;code&gt;CustomCommand(...)&lt;/code&gt; and its arguments in a header&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Where an operation takes its data from is the same rule everywhere:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;the value or the element&lt;/strong&gt; is the message body. In lists, hashes, sets, sorted sets and streams a &lt;code&gt;byte[]&lt;/code&gt; body is written as it is, without being turned into a string;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;scalar parameters&lt;/strong&gt; live in the address: &lt;code&gt;field&lt;/code&gt; for hashes, &lt;code&gt;score&lt;/code&gt;, &lt;code&gt;minScore&lt;/code&gt; and &lt;code&gt;maxScore&lt;/code&gt; for sorted sets, &lt;code&gt;start&lt;/code&gt; and &lt;code&gt;stop&lt;/code&gt; for ranges, &lt;code&gt;longitude&lt;/code&gt;, &lt;code&gt;latitude&lt;/code&gt;, &lt;code&gt;member1&lt;/code&gt;, &lt;code&gt;member2&lt;/code&gt; and &lt;code&gt;geoUnit&lt;/code&gt; for geo, &lt;code&gt;offset&lt;/code&gt; and &lt;code&gt;bit&lt;/code&gt; for bitmaps;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;sets of values&lt;/strong&gt; come in headers: the field map for &lt;code&gt;HMSET&lt;/code&gt; (&lt;code&gt;redbRedis.HashFields&lt;/code&gt;), the field names for &lt;code&gt;HMGET&lt;/code&gt; (&lt;code&gt;redbRedis.FieldNames&lt;/code&gt;), the source keys for &lt;code&gt;PFMERGE&lt;/code&gt; (&lt;code&gt;redbRedis.SourceKeys&lt;/code&gt;), the centre and the radius for &lt;code&gt;GEORADIUS&lt;/code&gt;, the arguments for &lt;code&gt;COMMAND&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The key, the field, the channel and the stream name may carry &lt;code&gt;${...}&lt;/code&gt; templates, which are resolved per message.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The result of an operation becomes the body of the next step.&lt;/strong&gt; &lt;code&gt;GET&lt;/code&gt; returns a string or &lt;code&gt;null&lt;/code&gt;, &lt;code&gt;INCR&lt;/code&gt; the new value of the counter, &lt;code&gt;LRANGE&lt;/code&gt; and &lt;code&gt;SMEMBERS&lt;/code&gt; an array of strings, &lt;code&gt;HGETALL&lt;/code&gt; a dictionary, &lt;code&gt;GEORADIUS&lt;/code&gt; the members it found:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="nf"&gt;From&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"direct://order-created"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;To&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Incr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"stats:orders:today"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"orders today: ${body}"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;SETNX&lt;/code&gt; writes the value only when the key is not there yet and returns &lt;code&gt;"OK"&lt;/code&gt; or &lt;code&gt;null&lt;/code&gt;. Together with &lt;code&gt;Ttl(...)&lt;/code&gt; that is a lock for the duration of the work, or a way to drop repeats.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pub/Sub: events for whoever is listening right now
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="nf"&gt;From&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"direct://publish-event"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;To&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Publish&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"orders.events"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;span class="nf"&gt;From&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"orders.events"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;To&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"direct://notify"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After a publish the number of recipients is in the body and in the &lt;code&gt;redbRedis.Publish.Recipients&lt;/code&gt; header. On the subscriber side the body is the message text, and the headers carry the channel (&lt;code&gt;redbRedis.Channel&lt;/code&gt;), the type (&lt;code&gt;PubSub&lt;/code&gt;) and the time it arrived.&lt;/p&gt;

&lt;p&gt;A pattern subscription is &lt;code&gt;PSUBSCRIBE&lt;/code&gt;: &lt;code&gt;From(Redis.PSubscribe("orders.*"))&lt;/code&gt; receives messages from every channel matching the pattern, and &lt;code&gt;redbRedis.Channel&lt;/code&gt; holds the channel the message actually came from. The &lt;code&gt;usePattern&lt;/code&gt; option turns a plain &lt;code&gt;SUBSCRIBE&lt;/code&gt; into a pattern subscription too.&lt;/p&gt;

&lt;p&gt;Redis Pub/Sub delivers a message only to those connected at the moment of the publish, and stores nothing. That is the right fit for notifications and cache invalidation. When you need delivery you can rely on, use Streams.&lt;/p&gt;

&lt;h2&gt;
  
  
  Streams: a log of messages with consumer groups
&lt;/h2&gt;

&lt;p&gt;Writing to a stream:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="nf"&gt;From&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"direct://order-created"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;To&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;XAdd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"orders"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;StreamMaxLength&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;100_000&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The body goes into a &lt;code&gt;data&lt;/code&gt; field, alongside a &lt;code&gt;timestamp&lt;/code&gt; field in milliseconds. For a field map of your own, pass a dictionary in the &lt;code&gt;redbRedis.StreamFields&lt;/code&gt; header. &lt;code&gt;StreamMaxLength&lt;/code&gt; trims the stream by length, approximately by default (&lt;code&gt;MAXLEN ~&lt;/code&gt;); &lt;code&gt;StreamApproximate(false)&lt;/code&gt; makes the trimming exact. The id of the new entry comes back in the body and in the &lt;code&gt;redbRedis.Stream.MessageId&lt;/code&gt; header.&lt;/p&gt;

&lt;p&gt;Reading with a consumer group:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="nf"&gt;From&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;XRead&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"orders"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ConsumerGroup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"billing"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ConsumerName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"node-1"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;StreamReadCount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;StreamClaimMinIdle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;60_000&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;To&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"direct://bill"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What happens underneath:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;the group is created for you&lt;/strong&gt; at start, together with the stream if it isn't there yet. By default it starts at the end of the stream and gets the entries added after it was created; &lt;code&gt;StreamStartPosition("0")&lt;/code&gt; starts at the first entry. If the group already exists, the consumer simply joins it;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;entries are read in batches&lt;/strong&gt; of &lt;code&gt;streamReadCount&lt;/code&gt;. With nothing new to read the consumer waits &lt;code&gt;streamBlockTimeMs&lt;/code&gt; (1000 ms by default) and polls again;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;the body&lt;/strong&gt; is the dictionary of the entry's fields, each field is also a &lt;code&gt;redbRedis.Stream.&amp;lt;field&amp;gt;&lt;/code&gt; header, and the entry id is in &lt;code&gt;redbRedis.MessageId&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;the consumer name&lt;/strong&gt; defaults to the machine name.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Several nodes sharing a group, each with its own consumer name, split the stream between them: every entry goes to exactly one of them. That is how one stream is processed by a cluster without duplicates.&lt;/p&gt;

&lt;h3&gt;
  
  
  Acknowledgement and a second attempt
&lt;/h3&gt;

&lt;p&gt;A group consumer acknowledges an entry (XACK) once the whole unit of work has finished well, the route transaction included. An entry whose route failed is not acknowledged and stays in the group's pending list, which is what makes this at-least-once.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;StreamClaimMinIdle(ms)&lt;/code&gt; brings those entries back into work. On every poll the consumer claims (XAUTOCLAIM) the group's entries that have been pending for at least that long and processes them again: its own failed ones, and the ones left behind by a consumer on a node that died. Pick an idle time longer than your slowest route, or an entry will be claimed while it is still being worked on.&lt;/p&gt;

&lt;p&gt;Where losing an entry is acceptable, there is &lt;code&gt;StreamNoAck()&lt;/code&gt;: reading goes with &lt;code&gt;NOACK&lt;/code&gt;, an entry counts as delivered the moment it is read and never enters the pending list (at-most-once). It does not combine with &lt;code&gt;StreamClaimMinIdle&lt;/code&gt;, and an endpoint asking for both is refused.&lt;/p&gt;

&lt;h3&gt;
  
  
  A stream without a group
&lt;/h3&gt;

&lt;p&gt;Without a group every consumer reads the whole stream and keeps the position itself, moving it past each entry it has read. That is how one log is handed to several independent readers, or replayed from the beginning:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="nf"&gt;From&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;XRead&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"orders"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;StreamStartPosition&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"0"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;To&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"direct://rebuild-projection"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With no &lt;code&gt;StreamStartPosition&lt;/code&gt; the consumer starts at the entries added after it started, &lt;code&gt;"0"&lt;/code&gt; reads from the first entry, and an entry id continues after that entry. The &lt;code&gt;&amp;gt;&lt;/code&gt; position means "not yet delivered to this consumer group" and only means anything to a group: without one the consumer is not created. Nothing holds a failed entry back when there is no group, and reading moves on.&lt;/p&gt;

&lt;h2&gt;
  
  
  A list as a job queue
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="nf"&gt;From&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"direct://enqueue-job"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;To&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;LPush&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"jobs"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;span class="nf"&gt;From&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"BRPOP"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"jobs"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ProcessingList&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"jobs:processing"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;PollDelay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;500&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;To&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"direct://run-job"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;LPUSH&lt;/code&gt; at the head and reading from the tail give a queue in arrival order. The consumer takes items one at a time by polling and waits &lt;code&gt;pollDelayMs&lt;/code&gt; while the list is empty. &lt;code&gt;BLPOP&lt;/code&gt; and &lt;code&gt;BRPOP&lt;/code&gt; here are the names of the operations rather than blocking commands: a blocking read would hold the shared connection the whole process works through.&lt;/p&gt;

&lt;p&gt;With &lt;code&gt;ProcessingList&lt;/code&gt; the queue is reliable. The item is moved (LMOVE) into the processing list and leaves it only after the route succeeded. A failed item goes back to the queue atomically, to the side it was taken from, and is processed again; whatever a previous run left in the processing list is returned to the queue at start. One consumer per processing list. &lt;code&gt;LMOVE&lt;/code&gt; is available in Redis 6.2 and later.&lt;/p&gt;

&lt;p&gt;Without &lt;code&gt;ProcessingList&lt;/code&gt; the item is popped before processing and a failed one is gone. That suits work you can afford to lose, such as warming a cache.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connections and secrets
&lt;/h2&gt;

&lt;p&gt;The shortest path is parameters in the address: &lt;code&gt;connectionString&lt;/code&gt; (&lt;code&gt;localhost:6379&lt;/code&gt; by default), &lt;code&gt;database&lt;/code&gt; and &lt;code&gt;password&lt;/code&gt;. The password is marked as a secret and is redacted in logs.&lt;/p&gt;

&lt;p&gt;In production a named connection factory in the context registry is nicer, because secrets stay out of the route address:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddToRegistry&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"prod"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;RedisConnectionFactory&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;ConnectionString&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"redis-1:6379,redis-2:6379"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;User&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"route"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Password&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;secrets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RedisPassword&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Ssl&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;SslProtocols&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Tls12, Tls13"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nf"&gt;From&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"direct://rates"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;To&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"rates:usd"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;ConnectionFactory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"prod"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;Ttl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;300&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The factory knows about Redis 6+ ACL users, TLS with a choice of protocols, Sentinel (&lt;code&gt;ServiceName&lt;/code&gt;), connect and operation timeouts, keep-alive, the reconnect policy (exponential or linear) and a channel prefix. Configuration mistakes are not masked: a factory name that is not in the registry, or a typo in &lt;code&gt;SslProtocols&lt;/code&gt;, gives a clear error on connect instead of a silent fall back to the defaults. The same goes for address parameters: an option the endpoint does not know, or a value of the wrong type, is refused and named, not quietly dropped.&lt;/p&gt;

&lt;p&gt;Every endpoint keeps one StackExchange.Redis connection and reconnects on its own. A lost and a restored connection are both logged.&lt;/p&gt;

&lt;h2&gt;
  
  
  Claim Check on Redis
&lt;/h2&gt;

&lt;p&gt;The Claim Check pattern from the Enterprise Integration Patterns catalog takes a heavy body out of the message for the length of a route and brings it back when it is needed again. &lt;code&gt;RedisClaimCheckRepository&lt;/code&gt; is the store for it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;claims&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;RedisClaimCheckRepository&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;RedisConnectionFactory&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;ConnectionString&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"redis.internal:6379"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="n"&gt;defaultTtl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;TimeSpan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;FromHours&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;span class="nf"&gt;From&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"direct://inbound-invoice"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ClaimCheck&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;claims&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ClaimCheckOperation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Push&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;// body into Redis, the key in the message&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;To&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"direct://route-by-headers"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ClaimCheck&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;claims&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ClaimCheckOperation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Pop&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;    &lt;span class="c1"&gt;// body back, the entry removed&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;To&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"direct://archive"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The store writes the data as it is, in binary, and puts Redis's own time to live on the entry. Keys get the &lt;code&gt;redb:claimcheck:&lt;/code&gt; prefix, which you can change. Read-and-remove is atomic: it runs as a single Lua script, so it works on Redis older than 6.2, where there is no &lt;code&gt;GETDEL&lt;/code&gt; yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Observability and shutdown
&lt;/h2&gt;

&lt;p&gt;Every producer call opens an OpenTelemetry span named &lt;code&gt;redis &amp;lt;OPERATION&amp;gt;&lt;/code&gt;, tagged &lt;code&gt;db.system=redis&lt;/code&gt;, with the resource and the operation on it. Redis calls show up in the same trace as the rest of the route.&lt;/p&gt;

&lt;p&gt;Consumers stop gracefully, as they do in every other redb.Route connector: they stop taking new messages and finish the ones already in flight.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet add package redb.Route
dotnet add package redb.Route.Redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Source: &lt;a href="https://github.com/redbase-app/redb-route" rel="noopener noreferrer"&gt;github.com/redbase-app/redb-route&lt;/a&gt;. The package is on &lt;a href="https://www.nuget.org/packages/redb.Route.Redis" rel="noopener noreferrer"&gt;NuGet&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;If this was useful — a ⭐ on &lt;a href="https://github.com/redbase-app" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; helps others find it.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;More of my writing: redbase.app/articles, and on &lt;a href="https://dev.to/rinat_kozin"&gt;dev.to&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>redis</category>
      <category>integration</category>
      <category>opensource</category>
    </item>
    <item>
      <title>XML routes in redb.Route: a schema the editor picks up, checks at build time, modules swapped live</title>
      <dc:creator>rinat kozin</dc:creator>
      <pubDate>Tue, 22 Sep 2026 18:27:21 +0000</pubDate>
      <link>https://dev.to/rinat_kozin/xml-routes-in-redbroute-a-schema-the-editor-picks-up-checks-at-build-time-modules-swapped-live-2j7c</link>
      <guid>https://dev.to/rinat_kozin/xml-routes-in-redbroute-a-schema-the-editor-picks-up-checks-at-build-time-modules-swapped-live-2j7c</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fydsrhln8q5p5n3aunowd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fydsrhln8q5p5n3aunowd.png" alt="redb.Route.Xml" width="800" height="420"&gt;&lt;/a&gt;&lt;br&gt;
"A route in .route.xml runs on the same engine as C#: completion in VS Code, package checks inside dotnet build, a graph editor and hot module swap.&lt;/p&gt;

&lt;p&gt;An integration route outlives the code around it. A partner moves to another SFTP folder, an analyst asks for one more branch for a new file type, support wants to know which path last night's rejected request took. These are questions about the route, and answering them through a C# project, a build and a redeploy costs more than the question does.&lt;/p&gt;

&lt;p&gt;In 4.0 redb.Route gained a second way to write a route: XML. A &lt;code&gt;.route.xml&lt;/code&gt; file goes into a package, the package into a folder of a running service, and less than half a second later the first message travels the new route. XML here is not a separate engine and not a simplified builder "for analysts". The loader turns markup into the same DSL calls you would write in C#, and the definition tree comes out identical. For every example in the repository that is pinned by tests: the markup, the C# generated from it and the tree the loader builds all agree.&lt;/p&gt;

&lt;p&gt;Around the format grew the things it was meant for: a schema the editor resolves by namespace, package checks that run inside &lt;code&gt;dotnet build&lt;/code&gt;, a graph editor in VS Code, packages that contribute their own elements, and modules with no assembly at all that a worker swaps while it runs. Everything below is shown on a working example.&lt;/p&gt;
&lt;h2&gt;
  
  
  Where the example comes from
&lt;/h2&gt;

&lt;p&gt;The serial numbers module came out of a &lt;a href="https://github.com/orgs/redbase-app/discussions/12" rel="noopener noreferrer"&gt;GitHub discussion&lt;/a&gt;. A reader described a system of four Quartz jobs with status tables between them and asked how that maps onto redb.Route. The answer became &lt;a href="https://github.com/redbase-app/redb-route/tree/main/demo/SerialNumbersDemo" rel="noopener noreferrer"&gt;SerialNumbersDemo&lt;/a&gt;: two partners (one over SFTP, one over AS2), SQL Server, objects in redb, a quota report on a schedule, and packaging into a &lt;code&gt;.tpkg&lt;/code&gt; for Tsak. Its routes are written in C#.&lt;/p&gt;

&lt;p&gt;Next to it lives the XML twin, &lt;code&gt;SerialNumbers.Xml&lt;/code&gt;. Domain, services and database are shared; only the way the flow is described changed. That makes a fair comparison: one integration, two spellings, one engine.&lt;/p&gt;
&lt;h2&gt;
  
  
  One route, two spellings
&lt;/h2&gt;

&lt;p&gt;The heart of the module is a serial number request. The file is validated against an XSD and unmarshalled into an object, the decision is taken inside a transaction, the response is queued, and only after the commit does the route log what has happened. In C#:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="nf"&gt;From&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;RouteUris&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SerialNumberRequest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;RouteId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"serial-number-request"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;MessageHistory&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;DoTry&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ValidateXsd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;XmlSchemas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SerialNumberRequest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Unmarshal&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;SerialNumberRequestXml&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;&lt;span class="s"&gt;"application/xml"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DoCatch&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ValidationException&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;()&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ProcessWithRedb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;IntakeRecorder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RecordInvalidAsync&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"${header.serials.partner}: ${header.serials.fileName} violates the schema"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;LogLevel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Warning&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Stop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;EndTryCatch&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Transacted&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ProcessWithRedb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SerialRequestService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RegisterAsync&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Choice&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;When&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;DecisionOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="n"&gt;MessageStatuses&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Accepted&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ProcessWithRedb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SerialRequestService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AllocateAsync&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ProcessWithRedb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SerialRequestService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;QueueResponseAsync&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;When&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;DecisionOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="n"&gt;MessageStatuses&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Rejected&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ProcessWithRedb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SerialRequestService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RejectAsync&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ProcessWithRedb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SerialRequestService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;QueueResponseAsync&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;EndChoice&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;EndTransaction&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="c1"&gt;// ...logs after the commit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same route in markup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;route&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"serial-number-request"&lt;/span&gt; &lt;span class="na"&gt;description=&lt;/span&gt;&lt;span class="s"&gt;"A serial number request: validate, decide, respond"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;from&lt;/span&gt; &lt;span class="na"&gt;uri=&lt;/span&gt;&lt;span class="s"&gt;"direct://serial-number-request"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;messageHistory/&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;tryCatch&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;try&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;validateXsd&lt;/span&gt; &lt;span class="na"&gt;file=&lt;/span&gt;&lt;span class="s"&gt;"SerialNumberRequest.xsd"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;unmarshal&lt;/span&gt; &lt;span class="na"&gt;format=&lt;/span&gt;&lt;span class="s"&gt;"application/xml"&lt;/span&gt;
                 &lt;span class="na"&gt;target=&lt;/span&gt;&lt;span class="s"&gt;"SerialNumbers.Core.Integration.Xml.SerialNumberRequestXml, SerialNumbers.Core"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/try&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;catch&lt;/span&gt; &lt;span class="na"&gt;exceptions=&lt;/span&gt;&lt;span class="s"&gt;"redb.Route.Validation.ValidationException"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;to&lt;/span&gt; &lt;span class="na"&gt;uri=&lt;/span&gt;&lt;span class="s"&gt;"bean:#intake?method=RecordInvalid"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;log&lt;/span&gt; &lt;span class="na"&gt;level=&lt;/span&gt;&lt;span class="s"&gt;"Warning"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;${header.serials.partner}: ${header.serials.fileName} violates the schema&lt;span class="nt"&gt;&amp;lt;/log&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;stop/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/catch&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/tryCatch&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;transaction&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;to&lt;/span&gt; &lt;span class="na"&gt;uri=&lt;/span&gt;&lt;span class="s"&gt;"bean:#serial-requests?method=Register"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;choice&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;when&lt;/span&gt; &lt;span class="na"&gt;expr=&lt;/span&gt;&lt;span class="s"&gt;"header.serials.decision == 'Accepted'"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;to&lt;/span&gt; &lt;span class="na"&gt;uri=&lt;/span&gt;&lt;span class="s"&gt;"bean:#serial-requests?method=Allocate"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;to&lt;/span&gt; &lt;span class="na"&gt;uri=&lt;/span&gt;&lt;span class="s"&gt;"bean:#serial-requests?method=QueueResponse"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/when&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;when&lt;/span&gt; &lt;span class="na"&gt;expr=&lt;/span&gt;&lt;span class="s"&gt;"header.serials.decision == 'Rejected'"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;to&lt;/span&gt; &lt;span class="na"&gt;uri=&lt;/span&gt;&lt;span class="s"&gt;"bean:#serial-requests?method=Reject"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;to&lt;/span&gt; &lt;span class="na"&gt;uri=&lt;/span&gt;&lt;span class="s"&gt;"bean:#serial-requests?method=QueueResponse"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/when&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/choice&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/transaction&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;log&lt;/span&gt; &lt;span class="na"&gt;level=&lt;/span&gt;&lt;span class="s"&gt;"Debug"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;${messageHistory()}&lt;span class="nt"&gt;&amp;lt;/log&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/route&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The correspondence is line by line. &lt;code&gt;DoTry&lt;/code&gt; and &lt;code&gt;DoCatch&lt;/code&gt; became &lt;code&gt;&amp;lt;tryCatch&amp;gt;&lt;/code&gt; with &lt;code&gt;&amp;lt;try&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;catch&amp;gt;&lt;/code&gt; branches, &lt;code&gt;Transacted()&lt;/code&gt; became &lt;code&gt;&amp;lt;transaction&amp;gt;&lt;/code&gt;, predicate lambdas became expressions in an &lt;code&gt;expr&lt;/code&gt; attribute. The transaction boundary is visible to the eye: everything inside &lt;code&gt;&amp;lt;transaction&amp;gt;&lt;/code&gt; commits together, everything outside it is written after the commit.&lt;/p&gt;

&lt;p&gt;A service call, &lt;code&gt;ProcessWithRedb(SerialRequestService.RegisterAsync)&lt;/code&gt;, became &lt;code&gt;bean:#serial-requests?method=Register&lt;/code&gt;. The bean is a thin wrapper that takes redb from the exchange and hands the exchange to the same service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;sealed&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SerialRequestBeans&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt; &lt;span class="nf"&gt;Register&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;IExchange&lt;/span&gt; &lt;span class="n"&gt;exchange&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;CancellationToken&lt;/span&gt; &lt;span class="n"&gt;ct&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;SerialRequestService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;RegisterAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;Redb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exchange&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;exchange&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ct&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt; &lt;span class="nf"&gt;Allocate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;IExchange&lt;/span&gt; &lt;span class="n"&gt;exchange&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;CancellationToken&lt;/span&gt; &lt;span class="n"&gt;ct&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;SerialRequestService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AllocateAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;Redb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exchange&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;exchange&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ct&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Reject, QueueResponse: the same&lt;/span&gt;

    &lt;span class="k"&gt;internal&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="n"&gt;IRedbService&lt;/span&gt; &lt;span class="nf"&gt;Redb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;IExchange&lt;/span&gt; &lt;span class="n"&gt;exchange&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;exchange&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ServiceProvider&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="n"&gt;GetService&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;IRedbService&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;()&lt;/span&gt;
           &lt;span class="p"&gt;??&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;InvalidOperationException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"The exchange carries no IRedbService."&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The redb instance is the one &lt;code&gt;ProcessWithRedb&lt;/code&gt; would have received: one connection per exchange, inside the transaction the route opened. The demo has ten such wrappers, and that is all the code the markup needed on top of the existing module. Markup decides &lt;strong&gt;when&lt;/strong&gt; a step runs, the service decides &lt;strong&gt;what&lt;/strong&gt; happens.&lt;/p&gt;

&lt;h2&gt;
  
  
  Not a second engine, a second spelling
&lt;/h2&gt;

&lt;p&gt;The property that matters most is easy to say and hard to overvalue: the markup executes nothing by itself. The loader reads the document and calls &lt;code&gt;Filter(...)&lt;/code&gt;, &lt;code&gt;When(...)&lt;/code&gt;, &lt;code&gt;SetHeader(...)&lt;/code&gt; and the rest of the DSL exactly as C# code would. What follows comes for free:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Everything the engine can do, the markup can do.&lt;/strong&gt; Retries, transactions, message history, metrics, secret redaction in URIs, mocks in the test kit: all of it lives in the engine and behaves the same for both spellings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A route converts back to C#.&lt;/strong&gt; &lt;code&gt;redb-route-xml csharp&lt;/code&gt; prints a &lt;code&gt;RouteBuilder&lt;/code&gt; class. In the readable style, markup comments become code comments; in the machine style the code carries &lt;code&gt;#line&lt;/code&gt; directives, so a debugger breakpoint lands on the line of the XML file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The diagram comes from the same source.&lt;/strong&gt; &lt;code&gt;redb-route-xml mermaid&lt;/code&gt; builds a flowchart from the definition tree, so the picture in your documentation cannot drift from the running route.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Migration goes one route at a time.&lt;/strong&gt; Both spellings live in one context, address the same &lt;code&gt;direct:&lt;/code&gt; endpoints and beans, and there is no reason to convert everything at once.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For the examples in the repository this is pinned by tests: each one is loaded and compared against a reference description, and from each one C# is generated, compiled in a test project and checked to build the very same tree. The markup has 198 tests on three target frameworks, net8, net9 and net10.&lt;/p&gt;

&lt;h2&gt;
  
  
  A schema the editor picks up by itself
&lt;/h2&gt;

&lt;p&gt;A markup document starts with a namespace:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;routes&lt;/span&gt; &lt;span class="na"&gt;xmlns=&lt;/span&gt;&lt;span class="s"&gt;"urn:redb:route:1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The VS Code extension hands the schema over for that namespace through an OASIS catalog, and from there &lt;a href="https://marketplace.visualstudio.com/items?itemName=redhat.vscode-xml" rel="noopener noreferrer"&gt;Red Hat XML&lt;/a&gt; does the work: completion for elements and attributes, enum values offered, errors underlined. A file gets the schema from what its root says, under any name and in any folder. Somebody else's &lt;code&gt;route.xml&lt;/code&gt; without our namespace is left alone.&lt;/p&gt;

&lt;p&gt;The schema is not written by hand. It is generated from the same element registry the loader uses, so the editor knows exactly what the service will later accept: 77 elements including the ones packages contribute, and typed options of 48 schemes. That is every connector plus the engine's own schemes, the ones most routes start from: &lt;code&gt;timer&lt;/code&gt;, &lt;code&gt;direct&lt;/code&gt;, &lt;code&gt;seda&lt;/code&gt;, &lt;code&gt;vm&lt;/code&gt;. For &lt;code&gt;sql:&lt;/code&gt; that means &lt;code&gt;dataSource&lt;/code&gt;, &lt;code&gt;placeholderStyle&lt;/code&gt; with its &lt;code&gt;At&lt;/code&gt;, &lt;code&gt;Colon&lt;/code&gt; and &lt;code&gt;Question&lt;/code&gt; values, &lt;code&gt;readOnly&lt;/code&gt; and the rest, each with its type and default. Options a connector marks as sensitive are shown as secrets.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Figgraalus9ttijy7gun3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Figgraalus9ttijy7gun3.png" alt="Completion and validation of the markup in VS Code" width="800" height="885"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The option catalog is built by reflection over connector assemblies. A connector gains an option, the catalog is regenerated, and the editor offers it without a line changing in the extension.&lt;/p&gt;

&lt;h2&gt;
  
  
  The graph editor: the text stays the truth
&lt;/h2&gt;

&lt;p&gt;The second mode of the same extension opens a route as a graph: &lt;code&gt;Open With&lt;/code&gt;, then &lt;code&gt;redb Route Graph&lt;/code&gt;, or the button in the editor title. The graph is a projection of the text, not a second storage format. The file is never reserialized: every edit in the graph becomes a pinpoint replacement in the text, usually one line, and undoes with plain &lt;code&gt;Ctrl+Z&lt;/code&gt;. Comments, indentation and attribute order stay as the author left them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcg6ow1bnu174yzzwlz7x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcg6ow1bnu174yzzwlz7x.png" alt="A route in the VS Code graph editor" width="800" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What it gives you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Two orientations, one look.&lt;/strong&gt; The route is drawn Mermaid-style: curved edges, diamonds for branchings, hexagons for conditions, brackets around &lt;code&gt;filter&lt;/code&gt; and &lt;code&gt;transaction&lt;/code&gt;. Top down it reads as a diagram; left to right it snakes, wrapping a long route onto a new row the way text wraps a line, with the carriage return drawn. Zoom is on buttons and &lt;code&gt;Ctrl&lt;/code&gt;+wheel, and both the layout and the zoom are remembered per file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A properties panel on click.&lt;/strong&gt; Identifier and description first, enums and flags as dropdowns. An endpoint URI is broken out into the connector's own options: the ones you set on top, the rest below, secrets masked. A &lt;code&gt;{{sftp.host}}&lt;/code&gt; placeholder is edited as written, with the value it resolves to from configuration shown next to it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Editing with the mouse.&lt;/strong&gt; A step is inserted through the "+" between steps and a palette built from the same element registry. A step is dragged to a new place or into a bracket. Right click opens a menu: insert before, after or inside, reveal in text, delete. A step travels with its comments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft76o6pe2jll4tqgxcfd3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft76o6pe2jll4tqgxcfd3.png" alt="The endpoint properties panel" width="800" height="810"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  An endpoint: a short URI or a structure
&lt;/h2&gt;

&lt;p&gt;A short address is written as in C#:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;to&lt;/span&gt; &lt;span class="na"&gt;uri=&lt;/span&gt;&lt;span class="s"&gt;"kafka://orders?key=${header.tripId}"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A long one reads better as a structure. SQL text goes into the element's content without escaping, parameters become their own lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;to&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;sql&lt;/span&gt; &lt;span class="na"&gt;dataSource=&lt;/span&gt;&lt;span class="s"&gt;"#main-db"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="cp"&gt;&amp;lt;![CDATA[ INSERT INTO auth_log(login, at) VALUES (:#login, :#at) ]]&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;param&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"login"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"${header.login}"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;param&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"at"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"${dateformat(now(), 'o')}"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/sql&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/to&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The loader assembles from that structure the same URI string a human would have typed, and one canonical form travels the pipeline: the endpoint cache, the statistics, mock patterns and secret redaction all see it. One rule keeps the format honest: &lt;strong&gt;no connector carries code written specially for XML&lt;/strong&gt;. The structured form, option types, completion and validation are all derived from what the connector already has. A new connector gets markup support on the day it appears.&lt;/p&gt;

&lt;h2&gt;
  
  
  Factories, configuration and secrets
&lt;/h2&gt;

&lt;p&gt;Objects the routes refer to are declared in the package's &lt;code&gt;context.xml&lt;/code&gt;. Connection factories are the main kind: they already live in the context registry by name, and a URI points at them. So the factory is declared in markup, its settings arrive as placeholders from configuration, and not a single secret stays in the URI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;bean&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"main-db"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"redb.Route.Sql.Connection.SqlConnectionFactory, redb.Route.Sql"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;constructorArg&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;bean&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"redb.Route.Sql.Connection.SqlConnectionOptions, redb.Route.Sql"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;property&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"ConnectionString"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"{{db.main.connection}}"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/bean&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/constructorArg&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/bean&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;{{key}}&lt;/code&gt; and &lt;code&gt;{{key:default}}&lt;/code&gt; resolve through the configuration chain before the value is converted, so &lt;code&gt;{{ldap.port:636}}&lt;/code&gt; honestly becomes a number. Every placeholder without a default lands in the package manifest as a required key: whoever deploys the module sees the list of settings to provide before anything starts.&lt;/p&gt;

&lt;p&gt;Some factories hold an object rather than a string. For AS2 those are certificates: your own with its private key, and the partner's. There a property takes a nested bean, and &lt;code&gt;factoryMethod&lt;/code&gt; builds the object with a static method instead of a constructor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;bean&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"globex"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"redb.Route.As2.As2ConnectionFactory, redb.Route.As2"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;property&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"OurCertificate"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;bean&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"System.Security.Cryptography.X509Certificates.X509CertificateLoader, System.Security.Cryptography.X509Certificates"&lt;/span&gt;
          &lt;span class="na"&gt;factoryMethod=&lt;/span&gt;&lt;span class="s"&gt;"LoadPkcs12FromFile"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;constructorArg&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"{{As2.CertificateDirectory}}/hub.pfx"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;constructorArg&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"{{As2.CertificatePassword}}"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/bean&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;property&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"As2From"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"{{As2.Id}}"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;property&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"As2To"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"GLOBEX"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;property&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"Sign"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;property&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"Encrypt"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/bean&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The AS2 partner is described in full: identifiers, the signing and encryption profile, the key material. The certificate password comes from the worker's configuration layer and never travels inside the package.&lt;/p&gt;

&lt;h2&gt;
  
  
  Packages bring their own elements
&lt;/h2&gt;

&lt;p&gt;The element registry is open. A connector package can add its own elements to the markup, and the schema, the package check and the editor learn about them from its assembly. That is how &lt;code&gt;&amp;lt;cache&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;rest&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;transformJson&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;payload&amp;gt;&lt;/code&gt; and the bridge to redb storage appeared: &lt;code&gt;&amp;lt;redbGet&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;redbSave&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;redbQuery&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;redbDelete&amp;gt;&lt;/code&gt;, plus a &lt;code&gt;&amp;lt;redb&amp;gt;&lt;/code&gt; block in the context.&lt;/p&gt;

&lt;p&gt;Here is a route from the second demo, &lt;code&gt;XmlDemo&lt;/code&gt;, which works with redb without a line of C#:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;route&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"redbdemo-cycle"&lt;/span&gt; &lt;span class="na"&gt;description=&lt;/span&gt;&lt;span class="s"&gt;"redb bridge: upsert one row by unique key, query it back"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;from&lt;/span&gt; &lt;span class="na"&gt;uri=&lt;/span&gt;&lt;span class="s"&gt;"timer://redbdemo?period={{demo.period:5000}}"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;setBody&lt;/span&gt; &lt;span class="na"&gt;expr=&lt;/span&gt;&lt;span class="s"&gt;'{"name":"xmldemo:heartbeat","value_unique":"xmldemo:heartbeat","properties":{"ProcessorName":"xmldemo","MessageKey":"heartbeat","Confirmed":true}}'&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;redbSave&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"redb.Route.RedbCore.Models.IdempotentEntryProps, redb.Route.Core"&lt;/span&gt; &lt;span class="na"&gt;byUnique=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;redbQuery&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"redb.Route.RedbCore.Models.IdempotentEntryProps, redb.Route.Core"&lt;/span&gt;
             &lt;span class="na"&gt;where=&lt;/span&gt;&lt;span class="s"&gt;"ProcessorName == 'xmldemo' AND MessageKey == 'heartbeat'"&lt;/span&gt;
             &lt;span class="na"&gt;orderBy=&lt;/span&gt;&lt;span class="s"&gt;"MessageKey"&lt;/span&gt; &lt;span class="na"&gt;take=&lt;/span&gt;&lt;span class="s"&gt;"10"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;setBody&lt;/span&gt; &lt;span class="na"&gt;expr=&lt;/span&gt;&lt;span class="s"&gt;"REDBDEMO total=${body.Count}"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;to&lt;/span&gt; &lt;span class="na"&gt;uri=&lt;/span&gt;&lt;span class="s"&gt;"log://redbdemo"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/route&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;&amp;lt;redbSave byUnique="true"&amp;gt;&lt;/code&gt; stores the object by a unique key: a row with that key is updated, no new one appears. &lt;code&gt;&amp;lt;redbQuery&amp;gt;&lt;/code&gt; turns the &lt;code&gt;where&lt;/code&gt; expression into a server-side redb query with ordering and a limit, rather than fetching everything and filtering in memory. An expression the database cannot run is rejected while the route loads, with a message that says why. The data schema is synchronised once, when the context starts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;context&lt;/span&gt; &lt;span class="na"&gt;xmlns=&lt;/span&gt;&lt;span class="s"&gt;"urn:redb:route:1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;redb&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;syncScheme&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"redb.Route.RedbCore.Models.IdempotentEntryProps, redb.Route.Core"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/redb&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/context&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The routes project
&lt;/h2&gt;

&lt;p&gt;XML routes live in an ordinary .NET project with a layout convention. One command creates it, &lt;code&gt;redb-route-xml new&lt;/code&gt;, and from there the package is built out of what sits in its places:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Path&lt;/th&gt;
&lt;th&gt;What is there&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;routes/*.route.xml&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;routes; load order comes from the manifest&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;context.xml&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;components, context beans, the one-off &lt;code&gt;&amp;lt;onInit&amp;gt;&lt;/code&gt; pipeline&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;resources/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;XSD, XSLT and anything routes reference by file name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;config/{Name}.config.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;module identity: context name and autostart&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;config/context.sample.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;a sample of the settings for whoever deploys it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;schema/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;the schema for working without the extension, bound in &lt;code&gt;.vscode&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Configuration is layered. Only the module identity travels inside the package; settings come from the worker's shared configuration and its override layer, secrets from environment variables on the worker. The same &lt;code&gt;.tpkg&lt;/code&gt; therefore goes to staging and to production without a rebuild: the environment changes, the package does not.&lt;/p&gt;

&lt;p&gt;If a routes project references its own types (as &lt;code&gt;SerialNumbers.Xml&lt;/code&gt; references the domain and the services), those are ordinary project and NuGet references. The build puts them in the output, and the package check sees them where the worker will.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tests: the same test kit
&lt;/h2&gt;

&lt;p&gt;An XML route is tested exactly as a C# one, with the same test kit and no test host of its own. Load the markup into a context, mock the external endpoint, send a message, assert. This is a test from the repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Fact&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt; &lt;span class="nf"&gt;TheCanonicalTestKitFlow_WorksOverAnXmlRoute&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;_context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddXmlRoutesFromContent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"""
&lt;/span&gt;        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;routes&lt;/span&gt; &lt;span class="n"&gt;xmlns&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"urn:redb:route:1.0"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;route&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"under-test"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"direct://tk-in"&lt;/span&gt;&lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;setHeader&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"seen"&lt;/span&gt; &lt;span class="k"&gt;value&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;&lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"kafka://orders"&lt;/span&gt;&lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;route&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;routes&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="s"&gt;""");
&lt;/span&gt;    &lt;span class="n"&gt;_context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AdviceAllRoutes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;MockEndpoints&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"kafka://*"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;_context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Start&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;mock&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Mock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"kafka://orders"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;ExpectMessageCount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;ExpectHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"seen"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"true"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;_context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;SendBody&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"direct://tk-in"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"payload"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;mock&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AssertIsSatisfiedAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;TimeSpan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;FromSeconds&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A route from a file loads the same way, with one line: &lt;code&gt;AddXmlRoutes("routes/orders.route.xml")&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;WeaveById&lt;/code&gt; finds a step by its &lt;code&gt;id&lt;/code&gt; attribute in the markup, so any step of an XML route can be replaced in a test without touching the file. A password from a URI never surfaces in mock names or test reports: redaction works on the same canonical URI string the running route uses.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checks before you ship
&lt;/h2&gt;

&lt;p&gt;Markup is edited by hand, so the format is built to surface a mistake as early as possible. The first line of defence is the loader: it collects &lt;strong&gt;all&lt;/strong&gt; errors of a document into one list with line and column numbers instead of stopping at the first. A broken expression in a condition is caught at load, not on the first message.&lt;/p&gt;

&lt;p&gt;The second line is the package check, &lt;code&gt;redb-route-xml check&lt;/code&gt; and &lt;code&gt;pack&lt;/code&gt;. It plugs straight into the build:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet build &lt;span class="nt"&gt;-p&lt;/span&gt;:PackRouteOnBuild&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt;:Version&lt;span class="o"&gt;=&lt;/span&gt;1.0.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the build the check runs against the fresh output and sees the real assemblies. What it verifies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the whole document against the schema, with the position of every error;&lt;/li&gt;
&lt;li&gt;registry references: &lt;code&gt;#main-db&lt;/code&gt; with no declaration in the package is named, while a SQL parameter &lt;code&gt;:#login&lt;/code&gt; is not a reference at all, the difference being where the hash sits;&lt;/li&gt;
&lt;li&gt;beans against the real assemblies: the type exists, &lt;code&gt;&amp;lt;property&amp;gt;&lt;/code&gt; properties are writable, the method in &lt;code&gt;bean:#x?method=M&lt;/code&gt; is really there;&lt;/li&gt;
&lt;li&gt;resources: the schema named by &lt;code&gt;validateXsd file=&lt;/code&gt; is in the package;&lt;/li&gt;
&lt;li&gt;secrets written literally, such as &lt;code&gt;password=...&lt;/code&gt; in a URI;&lt;/li&gt;
&lt;li&gt;required configuration keys, which go into the manifest.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is its answer to a typo in a bean method name and in an element name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;error: routes/serial-number-request.route.xml(22,10): The element 'catch' in namespace
       'urn:redb:route:1.0' has invalid child element 'stopp' ...
error: routes/serial-number-request.route.xml: bean 'serial-requests':
       type 'SerialNumbers.Xml.Beans.SerialRequestBeans' has no public method 'Regster'
       (bean:#serial-requests?method=Regster).
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And to the corrected file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;serial-numbers-xml 0.0.0: 1 artifact(s), 0 required config key(s) - ok
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A mistake in the markup becomes a build error, and a package with an error is not produced. A dangling reference, a missing method and a forgotten schema file are found on a developer machine, not in the log of a production worker.&lt;/p&gt;

&lt;p&gt;Separately the gate &lt;strong&gt;warns&lt;/strong&gt;, where the decision belongs to the author: a step that will never run (anything after &lt;code&gt;&amp;lt;stop/&amp;gt;&lt;/code&gt; in the same list), an undeclared &lt;code&gt;#name&lt;/code&gt; that module code may register at startup, and a condition that compares outside a placeholder. The last one is worth spelling out. Written &lt;code&gt;expr="${header.kind} == 'order'"&lt;/code&gt;, the line is rendered to text first, and non-empty text is true whatever it says, so that branch wins on every message and does so silently. Written without the braces, &lt;code&gt;header.kind == 'order'&lt;/code&gt;, it compares. The gate names the line where the braces are one pair too many.&lt;/p&gt;

&lt;p&gt;The tool also watches itself: built against a different version of &lt;code&gt;redb.Route.Xml&lt;/code&gt; than the project's assemblies, it stops and names both versions.&lt;/p&gt;

&lt;h2&gt;
  
  
  A module with no assembly of its own
&lt;/h2&gt;

&lt;p&gt;A package holding only &lt;code&gt;.route.xml&lt;/code&gt;, &lt;code&gt;context.xml&lt;/code&gt;, resources and configuration is a complete Tsak module. Drop the &lt;code&gt;.tpkg&lt;/code&gt; into the &lt;code&gt;modules&lt;/code&gt; folder of a running worker and it picks it up. This is the log for &lt;code&gt;XmlDemo&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;03:33:17.720 [INF] Registered module xmldemo v4.0.1
03:33:17.743 [INF] Created context xmldemo
03:33:17.881 [INF] XmlRouteModule xmldemo: loaded 1 artifact(s)
03:33:18.091 [INF] Exchange [redbdemo-cycle]: Body: REDBDEMO total=1
03:33:18.095 [INF] Context 'xmldemo' started successfully: all 1 endpoints operational
03:33:23.108 [INF] Exchange [redbdemo-cycle]: Body: REDBDEMO total=1
03:33:28.134 [INF] Exchange [redbdemo-cycle]: Body: REDBDEMO total=1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From registering the module to the first exchange: 0.37 seconds. The counter stays at one tick after tick, because saving by a unique key updates the same row. Delete the file from &lt;code&gt;modules&lt;/code&gt; and the module unloads just as quietly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;03:34:27.821 [INF] Package xmldemo-4.0.1.tpkg removed from disk, unloading 1 modules
03:34:27.857 [INF] Removed context xmldemo
03:34:27.871 [INF] Module xmldemo unloaded: context stopped, ALC released
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A module that does need code ships its assembly in the same package. The worker brings up the module's code first and the markup second, so objects the code put in the registry are visible to the markup by &lt;code&gt;#name&lt;/code&gt;. That is how &lt;code&gt;SerialNumbers.Xml&lt;/code&gt; works: its assembly holds the bean wrappers and the bootstrap that raises the demo database, while the whole flow is described in XML. How Tsak assembles services out of modules is covered in the article on &lt;a href="https://redbase.app/articles/tsak-microservices" rel="noopener noreferrer"&gt;microservices with Tsak&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Expressions: one language, errors at load
&lt;/h2&gt;

&lt;p&gt;The expression language is the same one C# routes use, covered in a separate article on &lt;a href="https://redbase.app/articles/route-expressions" rel="noopener noreferrer"&gt;redb.Route expressions&lt;/a&gt;. Three things matter for XML.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Position decides meaning.&lt;/strong&gt; In a condition (&lt;code&gt;filter&lt;/code&gt;, &lt;code&gt;when&lt;/code&gt;, &lt;code&gt;validate&lt;/code&gt;) the string becomes a predicate; in a value (&lt;code&gt;setBody&lt;/code&gt;, &lt;code&gt;setHeader&lt;/code&gt;, &lt;code&gt;toD&lt;/code&gt;) it becomes an evaluated object; in &lt;code&gt;uri&lt;/code&gt; and &lt;code&gt;id&lt;/code&gt; it stays a literal. You never have to ask whether something is an expression: the attribute it sits in answers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Whitespace around operators does not matter&lt;/strong&gt;, which is convenient in XML specifically. In an attribute value the greater-than sign needs no escaping while less-than does, so a comparison without spaces is also shorter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;filter&lt;/span&gt; &lt;span class="na"&gt;expr=&lt;/span&gt;&lt;span class="s"&gt;"header.amount&amp;gt;1000"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;filter&lt;/span&gt; &lt;span class="na"&gt;expr=&lt;/span&gt;&lt;span class="s"&gt;"header.amount &amp;amp;gt; 1000"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;filter&lt;/span&gt; &lt;span class="na"&gt;expr=&lt;/span&gt;&lt;span class="s"&gt;"header.amount &amp;amp;lt; 10"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Diagnostics read as expressions.&lt;/strong&gt; &lt;code&gt;messageHistory()&lt;/code&gt; returns the trail of an exchange step by step: as a table, as a single line &lt;code&gt;log &amp;gt; choice &amp;gt; to(http)&lt;/code&gt;, as a JSON array, or as numbers (&lt;code&gt;'count'&lt;/code&gt;, &lt;code&gt;'totalMs'&lt;/code&gt;, &lt;code&gt;'slowestMs'&lt;/code&gt;). &lt;code&gt;stats('otel:...')&lt;/code&gt; reads counters of the OpenTelemetry layer that endpoint statistics do not carry: &lt;code&gt;throttle&lt;/code&gt; delays, &lt;code&gt;circuitbreaker&lt;/code&gt; trips, messages dropped by &lt;code&gt;filter&lt;/code&gt;. In markup that turns into conditions which used to need code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;setHeader&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"trail"&lt;/span&gt; &lt;span class="na"&gt;expr=&lt;/span&gt;&lt;span class="s"&gt;"messageHistory('compact')"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;choice&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;when&lt;/span&gt; &lt;span class="na"&gt;expr=&lt;/span&gt;&lt;span class="s"&gt;"messageHistory('slowestMs') &amp;amp;gt; 500"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;log&lt;/span&gt; &lt;span class="na"&gt;level=&lt;/span&gt;&lt;span class="s"&gt;"Warning"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;${routeId} slow: ${messageHistory()}&lt;span class="nt"&gt;&amp;lt;/log&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/when&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/choice&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The trail is recorded when &lt;code&gt;&amp;lt;messageHistory/&amp;gt;&lt;/code&gt; is in the route or the engine option is on. Where it was never enabled, the function answers with an empty string and a zero: a diagnostic log must not bring the route down.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to know before you start
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Topology is written out.&lt;/strong&gt; In the C# demo the SFTP consumer and the delivery route are created in a loop over the partners in the database. The markup describes each partner as its own route, so the topology is in the file rather than computed at startup. With a dozen partners that change by deployment, that reads better. When partners are a table that changes at runtime, a C# builder in the same package builds those routes while the markup describes the shared part of the flow. Both spellings live in one context.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code stays where code belongs.&lt;/strong&gt; Business logic lives in services, the markup calls them through beans. When a service signature differs from &lt;code&gt;(IExchange)&lt;/code&gt; or &lt;code&gt;(IExchange, CancellationToken)&lt;/code&gt;, a two-line wrapper sits between them, as above.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;XML is added, it does not replace.&lt;/strong&gt; Routes move to markup one at a time while the rest keep running in C#. If a route outgrows the markup, &lt;code&gt;redb-route-xml csharp&lt;/code&gt; turns it into code, and from there it evolves as an ordinary &lt;code&gt;RouteBuilder&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;The tool installs from NuGet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet tool &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; redb.Route.Xml.CodeGen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It creates a routes project by the package convention, with the schema and the editor binding in place:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;redb-route-xml new Orders &lt;span class="nt"&gt;--context&lt;/span&gt; orders
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The project builds and packs with the check, as shown above. From there the &lt;code&gt;.tpkg&lt;/code&gt; goes into a Tsak worker's &lt;code&gt;modules&lt;/code&gt;, and a route turns into C# or into a diagram whenever you want:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet build &lt;span class="nt"&gt;-p&lt;/span&gt;:PackRouteOnBuild&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt;:Version&lt;span class="o"&gt;=&lt;/span&gt;1.0.0
redb-route-xml csharp routes/main.route.xml &lt;span class="nt"&gt;--namespace&lt;/span&gt; Orders.Routes
redb-route-xml mermaid routes/main.route.xml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The markup library is the &lt;code&gt;redb.Route.Xml&lt;/code&gt; package, version 4.1.0; the VS Code extension ships as a &lt;code&gt;.vsix&lt;/code&gt; attached to the &lt;a href="https://github.com/redbase-app/redb-route" rel="noopener noreferrer"&gt;redb-route release on GitHub&lt;/a&gt;. Both demos live in the &lt;code&gt;demo&lt;/code&gt; folder of the same repository.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;If this was useful — a ⭐ on &lt;a href="https://github.com/redbase-app" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; helps others find it.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;More of my writing: &lt;a href="https://redbase.app/articles" rel="noopener noreferrer"&gt;redbase.app/articles&lt;/a&gt;, and on &lt;a href="https://dev.to/grelikt"&gt;dev.to&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>integration</category>
      <category>vscode</category>
      <category>eip</category>
    </item>
    <item>
      <title>redb 4.0.1 is out: a reliability release for all four .NET products. Transactions, the SQL connector and cluster isolation got the most work. Pro stays free, no license key.
https://redbase.app/
https://github.com/redbase-app</title>
      <dc:creator>rinat kozin</dc:creator>
      <pubDate>Fri, 18 Sep 2026 14:34:54 +0000</pubDate>
      <link>https://dev.to/rinat_kozin/redb-401-is-out-a-reliability-release-for-all-four-net-products-transactions-the-sql-3fc1</link>
      <guid>https://dev.to/rinat_kozin/redb-401-is-out-a-reliability-release-for-all-four-net-products-transactions-the-sql-3fc1</guid>
      <description>&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
      &lt;div class="c-embed__body flex items-center justify-between"&gt;
        &lt;a href="https://redbase.app/" rel="noopener noreferrer" class="c-link fw-bold flex items-center"&gt;
          &lt;span class="mr-2"&gt;redbase.app&lt;/span&gt;
          

        &lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://github.com/redbase-app" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Favatars.githubusercontent.com%2Fu%2F256871492%3Fs%3D280%26v%3D4" height="280" class="m-0" width="280"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://github.com/redbase-app" rel="noopener noreferrer" class="c-link"&gt;
            redbase-app · GitHub
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            redbase-app has 4 repositories available. Follow their code on GitHub.
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.githubassets.com%2Ffavicons%2Ffavicon.svg" width="32" height="32"&gt;
          github.com
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


</description>
    </item>
  </channel>
</rss>
