Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Coming from Apache Camel

rust-camel shares Apache Camel's pattern vocabulary because the vocabulary is proven. The implementation is independent. The runtime, the type system, and the execution model are all different. A Camel user recognizes Filter, Content-Based Router, and Splitter. rust-camel is not a drop-in replacement and never claims Camel compatibility. See ADR-0046 for the design stance.

Core vocabulary

Apache Camelrust-camelNotes
CamelContextCamelContextSame name. Built with CamelContext::builder(). No Spring or CDI.
RouteRouteDefinitionBuilt with RouteBuilder (Rust) or parsed from YAML.
RouteBuilder (Java DSL)RouteBuilder (Rust)Same fluent style: .from().to().build().
XML DSLYAML DSLNo XML DSL. Declarative routes use YAML.
ProcessorService<Exchange>Every processor is a Tower Service. No Java interface to implement.
ExchangeExchangeSame concept. Carries input Message, optional output Message, headers, properties.
MessageMessageBody + headers container inside Exchange.
BodyBodyEnum: Text, Json, Bytes, Stream, Empty. Not Object.
EndpointEndpointResolved from a URI scheme (e.g. timer:tick, log:info).
ComponentComponentRegistered on CamelContext. Same scheme names as Camel (timer, log, file, http, kafka).
Channel(no equivalent)No first-class Channel type. The from:/to: URI pair fills this role.
BeanRegistryBeanRegistryNamed instances, resolved at route start time.

EIP names

Most EIP step names match between Apache Camel and rust-camel. The YAML DSL uses snake_case (wire_tap, load_balance) where Apache Camel's XML uses camelCase (wireTap, loadBalance).

Apache Camel (Java/XML)rust-camel YAMLrust-camel Rust
choicechoice.choice()
whenwhen (under choice).when(predicate)
otherwiseotherwise (under choice).otherwise()
filterfilter.filter(predicate)
splitsplit.split(config)
aggregateaggregate.aggregate(config)
multicastmulticast.multicast()
wireTapwire_tap.wire_tap(uri)
loadBalanceload_balance.load_balance()
recipientListrecipient_list.recipient_list(expr)
routingSliprouting_slip.routing_slip(expr)
throttlethrottle.throttle(n, duration)
delaydelay.delay(duration)
looploop.loop_count(n)
marshalmarshal.marshal(format)
unmarshalunmarshal.unmarshal(format)
enrichenrich.enrich(uri)
pollEnrichpoll_enrich.poll_enrich(uri, timeout)
validatevalidate.validate(predicate)
doTrydo_try.do_try()
doCatchcatch (under do_try).do_catch_exception(&[...])
doFinallyfinally (under do_try).do_finally()
circuitBreakercircuit_breaker (route-level).circuit_breaker(config)
transformtransform.transform(body) (alias for set_body)
setBodyset_body.set_body(value)
setHeaderset_header.set_header(key, value)
scriptscript.script(language, source)

Execution model

Apache Camel runs processors in a pipeline backed by a Java service architecture. rust-camel runs processors as Tower Service<Exchange> steps in a Tower middleware chain. This means:

  • Every step is Clone + Send + Sync + 'static.
  • Backpressure is explicit through Tower's poll_ready.
  • The pipeline outcome is Completed, Stopped, or Failed (see ADR-0024). Stopped is not an error.

Error handling

Apache Camelrust-camelNotes
onException(Exception.class)on_exceptions: [{ exception: [...] }]Match by variant name.
errorHandler(deadLetterChannel)error_handler: { dead_letter_channel: ... }Route-level config.
handled(true)disposition: HandledAbsorbs the error. Route terminates normally.
continued(true)disposition: ContinuedClears the error. Advances to the next step.
maximumRedeliveriesretry(max).with_backoff(...)Retry on the builder.

See ADR-0019 for the exception disposition contract.

What rust-camel does not have

Apache Camel featureStatusAlternative
Spring XML DSLNot plannedYAML DSL
CDI / Spring DINot plannedRust trait system, manual registration
JMXNot plannedOpenTelemetry, metrics endpoints
Bean annotation scanningNot plannedExplicit bean registration
Normalizer EIPNot implementedCompose from Convert Body + Content-Based Router
Content Filter EIPNot implementedUse Script or process closure to strip fields
Detour EIPNot implementedCompose from filter + to
Transaction ClientNot implementedFuture work

Body types

Apache Camel uses Object as the body type and relies on type converters. rust-camel uses a Body enum with five variants:

VariantHolds
Body::TextUTF-8 string
Body::JsonParsed JSON value
Body::BytesRaw byte buffer
Body::StreamAsync stream (materialized by Stream Cache)
Body::EmptyNo payload

The Exchange and Message page covers typed body access. The Convert Body step changes between variants. The Marshal and Unmarshal step converts between wire formats (JSON, CSV, XML, ZIP) and these variants.

Getting started

If you are new to rust-camel, start with these pages:

PageCovers
Getting startedInstall and run your first route
Core conceptsExchange, routes, components
EIP patternsThe pattern catalogue
YAML DSL route structureDeclarative route syntax