Class TemplateRouteDefinitionExtensions

Assembly: redb.Route.Templates.dll

DSL of the payload template step. A string argument is a locator (file path relative
to , or assembly:Name/path); inline text is
written as TextSource.Inline("...").

.SetBodyTemplate("Templates/order-confirm.json.sbn", MediaType.Json)
.SetBodyTemplate(TextSource.Inline("""{"id": {{ headers.orderId }}}"""), MediaType.Json)
.SetBodyTemplate("Templates/notify.xml.sbn", MediaType.Xml, a => a
.Set("customer", "header.customerId")
.Set("total", "header.amount * header.qty")
.SetValue("channel", "email"))
.SetHeaderTemplate("X-Summary", TextSource.Inline("{{ body.items | array.size }} items"), MediaType.Text)

public static class TemplateRouteDefinitionExtensions

Inheritance

Object→TemplateRouteDefinitionExtensions

Methods

SetBodyTemplate(IRouteDefinition, string, MediaType, Action<TemplateArgs>?)

Renders the template into the message body; ContentType follows mediaType.

public static IRouteDefinition SetBodyTemplate(this IRouteDefinition route, string locator, MediaType mediaType, Action<TemplateArgs>? args = null)

SetBodyTemplate(IRouteDefinition, TextSource, MediaType, Action<TemplateArgs>?)

Renders the template into the message body; ContentType follows mediaType.

public static IRouteDefinition SetBodyTemplate(this IRouteDefinition route, TextSource source, MediaType mediaType, Action<TemplateArgs>? args = null)

SetHeaderTemplate(IRouteDefinition, string, string, MediaType, Action<TemplateArgs>?)

Renders the template into header name.

public static IRouteDefinition SetHeaderTemplate(this IRouteDefinition route, string name, string locator, MediaType mediaType, Action<TemplateArgs>? args = null)

SetHeaderTemplate(IRouteDefinition, string, TextSource, MediaType, Action<TemplateArgs>?)

Renders the template into header name.

public static IRouteDefinition SetHeaderTemplate(this IRouteDefinition route, string name, TextSource source, MediaType mediaType, Action<TemplateArgs>? args = null)

SetPropertyTemplate(IRouteDefinition, string, string, MediaType, Action<TemplateArgs>?)

Renders the template into exchange property key.

public static IRouteDefinition SetPropertyTemplate(this IRouteDefinition route, string key, string locator, MediaType mediaType, Action<TemplateArgs>? args = null)

SetPropertyTemplate(IRouteDefinition, string, TextSource, MediaType, Action<TemplateArgs>?)

Renders the template into exchange property key.

public static IRouteDefinition SetPropertyTemplate(this IRouteDefinition route, string key, TextSource source, MediaType mediaType, Action<TemplateArgs>? args = null)