Expand description
JavaScript language plugin for Apache Camel Rust.
Provides JsLanguage — a Language implementation
backed by the Boa JavaScript engine.
§Resource Limits
Scripts are bounded by configurable limits sourced from [languages.js.limits]
in Camel.toml. When absent, rust-camel runtime defaults apply:
| Limit | Default | Source |
|---|---|---|
execution-timeout-ms | 5,000 | tokio::time::timeout + spawn_blocking |
max-loop-iterations | 100,000 | Boa RuntimeLimits::set_loop_iteration_limit |
max-recursion-depth | 512 | Boa RuntimeLimits::set_recursion_limit |
max-stack-size | 10,240 slots | Boa RuntimeLimits::set_stack_size_limit |
§Covered threats
- Infinite loops (
while (true) {}) — tripmax-loop-iterations. - Deep recursion — trips
max-recursion-depth. - Stack exhaustion — trips
max-stack-size. - Wall-clock stalls — bounded by
execution-timeout-ms.
§NOT covered
Heap cap — boa_engine 0.21 does not expose a heap-size limit. A script
that allocates many small objects can exhaust process memory before any other
limit trips. Route authors writing JS that allocates heavily should validate
their scripts carefully; untrusted JS should use function: (ADR-0005,
out-of-process) instead of js:/javascript:.
§Timeout caveat
Same as Rhai: when execution-timeout-ms fires, the route future resolves
to an error, but the blocking thread may continue executing until a
RuntimeLimits bound trips or the script finishes.
Re-exports§
pub use engines::BoaEngine;pub use error::JsLanguageError;
Modules§
- engines
- error
- value
- Conversions between
serde_json::Valueandboa_engine::JsValue.
Structs§
- JsEval
Result - The result of evaluating a JS expression.
- JsExchange
- A snapshot of exchange state passed into and out of JS evaluation.
- JsLanguage
- JavaScript language plugin backed by Boa.
Traits§
- JsEngine
- Abstraction over a JavaScript engine capable of evaluating expressions
against a
JsExchangecontext.