Class RouteBuilder
Abstract base class for defining routes using the new DSL.
Subclass and implement to define routes with the canonical
ProcessorDefinition model.
public class MyRoutes : RouteBuilder
{
protected override void Configure()
{
From("direct://input")
.SetBody("hello")
.To("direct://output");
From("timer://heartbeat?period=5000")
.Log("tick");
}
}
context.AddRoutes(new MyRoutes());
public abstract class RouteBuilder : IRouteBuilder
Inheritance
Implements
Derived
Properties
Context
Gets the route context, available inside after registration.
protected IRouteContext? Context { get; }
Definitions
Gets the route definitions created during .
public IReadOnlyList<RouteDefinition> Definitions { get; }
ExceptionDefinitions
Exception handlers declared on this builder via — they apply to every route it defines, and to no route of another builder.
public IReadOnlyList<OnExceptionDefinition> ExceptionDefinitions { get; }
Intercepts
Intercepts declared on this builder — they apply to every route it defines, and to no route of another builder.
public IReadOnlyList<InterceptDefinition> Intercepts { get; }
OnCompletions
OnCompletion blocks declared on this builder — they apply to every route it defines, and to no route of another builder.
public IReadOnlyList<OnCompletionDefinition> OnCompletions { get; }
RouteConfigurations
Route configurations declared on this builder (, a
public IReadOnlyList<RouteConfigurationDefinition> RouteConfigurations { get; }
Methods
Body()
Creates an expression that reads the exchange message body.
protected static BodyExpression Body()
Constant(object)
Creates a constant expression that always returns the specified value.
protected static ConstantExpression Constant(object value)
Exchange(Func<IExchange, object?>)
Creates an expression evaluated from the exchange using a delegate.
protected static ExchangeExpression Exchange(Func<IExchange, object?> func)
Expr(string)
Creates a string expression that evaluates a ${...} template or raw expression.
public static StringExpression Expr(string template)
From(string)
Starts a new route definition with the given source endpoint. Public so that DSL layers built
public IRouteDefinition From(string uri)
Header(string)
Creates an expression that reads a message header value.
protected static HeaderExpression Header(string name)
Intercept()
Steps that run before every step of every route in this builder (Camel intercept()).
public InterceptDefinition Intercept()
InterceptFrom(string?)
Steps that run when a message enters any route of this builder whose From matches the mask (all routes when null).
public InterceptDefinition InterceptFrom(string? uriPattern = null)
InterceptSendToEndpoint(string)
Steps that run before any To / ToD in this builder whose target matches the mask; .SkipSendToOriginalEndpoint() replaces the send.
public InterceptDefinition InterceptSendToEndpoint(string uriPattern)
jpath(string)
Creates a JsonPath expression for extracting data from the message body.
protected static JsonPathExpression jpath(string path)
JPath(string)
Creates a JsonPath expression for extracting data from the message body.
protected static JsonPathExpression JPath(string path)
jpath<T>(string)
Creates a typed JsonPath expression that converts the result to T.
protected static TypedJsonPathExpression<T> jpath<T>(string path)
JPath<T>(string)
Creates a typed JsonPath expression that converts the result to T.
protected static TypedJsonPathExpression<T> JPath<T>(string path)
Method(string, string)
Apache Camel's method(ref, "name"): a registry bean's method as an expression or a condition, for
public static IPredicateExpression Method(string reference, string methodSpec)
OnCompletion()
Steps that run after any route of this builder finished with an exchange (on a copy, outside the route's transaction).
public OnCompletionDefinition OnCompletion()
OnException(params Type[])
Defines an exception handler for multiple exception types at once, for all routes of this builder.
public OnExceptionDefinition OnException(params Type[] exceptionTypes)
OnException<TException>()
Defines an exception handler for all routes of this builder (Apache Camel's RouteBuilder scope) — not for
public OnExceptionDefinition OnException<TException>() where TException : Exception
Placeholder(string)
A value from configuration: {{key}} / {{key:default}} resolved through the route context, as in an
public static PlaceholderExpression Placeholder(string text)
Property(string)
Creates an expression that reads an exchange property value.
protected static PropertyExpression Property(string name)
RouteConfiguration(string?)
Starts a route configuration (Apache Camel's Route Configuration): error handling for the routes of every
protected RouteConfigurationDefinition RouteConfiguration(string? id = null)
SplitJsonArray()
Creates a splitter function that splits a JSON array body into individual elements.
protected static Func<IExchange, IAsyncEnumerable<object?>> SplitJsonArray()
SplitLines(string, bool)
Creates a splitter function that splits the body into lines.
protected static Func<IExchange, IAsyncEnumerable<object?>> SplitLines(string separator = "\n", bool skipEmpty = false)
SplitXml(string, string?)
Creates a splitter function that extracts XML elements by local name.
protected static Func<IExchange, IAsyncEnumerable<object?>> SplitXml(string elementName, string? inheritNamespaceFrom = null)
xpath(string, XPathResult)
Creates an XPath expression with an explicit XPath-level result type.
protected static XPathExpression xpath(string path, XPathResult result)
XPath(string, XPathResult)
Creates an XPath expression with an explicit XPath-level result type.
protected static XPathExpression XPath(string path, XPathResult result)
xpath(string)
Creates an XPath expression for extracting data from an XML message body.
protected static XPathExpression xpath(string path)
XPath(string)
Creates an XPath expression for extracting data from an XML message body.
protected static XPathExpression XPath(string path)
xpath<T>(string)
Creates a typed XPath expression that converts the result to T.
protected static TypedXPathExpression<T> xpath<T>(string path)
XPath<T>(string)
Creates a typed XPath expression that converts the result to T.
protected static TypedXPathExpression<T> XPath<T>(string path)