Croway opened a new pull request, #26309:
URL: https://github.com/apache/camel/pull/26309
Follow-up to the review of #25778: parity with camel-javascript within the
JSON-only security model.
- A frozen `camel` facade over QuickJS4J host functions in a `camel`
builtins module: `getBody/setBody`, `get/set/removeHeader`,
`get/set/removeProperty`, `get/set/removeVariable`, `log(level, message)`. The
facade captures the real `java_invoke` in a closure scripts cannot reach and
only dispatches to that module with a fixed arity per function; `java_invoke`,
`quickjs4j_engine` and `camelQuickjs` stay stubbed on `globalThis` while a
script runs, as before. The current exchange is held per thread, so the API is
available to route expressions, not to the generic `ScriptingLanguage.evaluate`.
- New bindings `variables` and `exception` (`{type, message}` or null).
- Route scripts are compiled once per engine instead of `new Function` +
`eval` per evaluation: embedded in the guest library (as `return (script)` for
a single expression, through `eval` otherwise so statement scripts keep their
completion value), compiled with `compilePortableGuestFunction` and run with
`invokePrecompiledGuestFunction`, with a bounded LRU of compiled scripts per
engine.
- Syntax errors in statement scripts are reported at compile time; a script
that throws discards the thread's engine (the runtime panics on its next
compile otherwise); engines are recycled on memory/evaluation count
(CAMEL-24687, included here as its own commit).
**Measured.** Expressions 1.7k → 3.9k ops/s (2.3×), route 843 → 1,848 msg/s
on one thread and 5,346 → 10,411 on eight. Docs and the catalog mirror cover
the variables, the `camel` API, the expression/statement rule and the engine
lifecycle. 55 tests in the module.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
_Claude Code on behalf of Croway_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]