ramu11 opened a new pull request, #25778:
URL: https://github.com/apache/camel/pull/25778
# Description
Add a new Preview quickjs language to Apache Camel using QuickJS4J 0.1.0.
The new language provides a lightweight JavaScript runtime based on QuickJS
compiled to WebAssembly and executed through Endive, without JNI/native
libraries.
### Implementation
- Adds the new camel-quickjs module.
- Adds QuickjsExpression, QuickjsLanguage, QuickjsHelper, and related
language integration.
- Supports Java DSL usage:
- .quickjs("...")
- .quickjs("...", ResultType.class)
- Integrates the language with Camel model metadata, endpoint DSL, XML/YAML
DSL, catalog, and generated schemas.
- Supports loading scripts using resource:classpath: and resource:file:.
### Exchange bindings and security
The JavaScript runtime receives JSON-based snapshots of:
- body
- headers
- properties
- exchangeId
Live Exchange, Message, CamelContext, Java classes, and class loaders are
not exposed to scripts.
Streaming bodies are rejected without consuming them. QuickJS4J host
plumbing such as java_invoke and quickjs4j_engine is also blocked from script
scope.
### Runtime and lifecycle
- Creates an engine lazily per worker thread.
- Avoids sharing engines between concurrent evaluations.
- Tracks engines for cleanup during stop().
- Uses generation invalidation to prevent stale engines after lifecycle
changes.
- Resets captured stderr between evaluations.
### Testing
Tests cover:
- Basic JavaScript evaluation
- JSON/body/header/property bindings
- Predicates and result types
- Java DSL and endpoint usage
- Error handling
- Resource loading
- Serialization
- Streaming bodies
- Security and host-object isolation
- Concurrent evaluation
- Engine lifecycle and cleanup
Validation performed:
./mvnw -q test -pl components/camel-quickjs
./mvnw -q -Psourcecheck -DskipTests -pl components/camel-quickjs
Both completed successfully.
Native-image compatibility and architecture-specific support have not been
validated as part of this module.
--
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]