camel-function
Out-of-process function runtime for rust-camel.
Provides the function: DSL step — executes user-supplied TypeScript/JavaScript functions inside Deno containers with automatic lifecycle management, hot-reload, and structured error mapping.
See docs/function-step.md for the full DSL reference.
Quick Start
use ;
use CamelContext;
use Duration;
async
ContainerProvider options
| Builder method | Type | Default | Description |
|---|---|---|---|
.image(s) |
&str |
— | Docker image to use as function runner (required) |
.pull_policy(p) |
PullPolicy |
IfMissing |
Never: no pull; Always: pull on every start; IfMissing: pull only if image not found locally |
.boot_timeout(d) |
Duration |
30s | Max time to wait for the container /health endpoint to respond after spawn |
.instance_id(s) |
&str |
random UUID | Scopes container labels for test isolation |
Runner
Endpoints on port 8080: GET /health, POST /register, POST /invoke, POST /shutdown.
Security: --allow-net=0.0.0.0 --allow-env=PORT only.
Container Lifecycle
- Containers are spawned on first function registration per runtime.
ContainerProvider::Dropattempts graceful shutdown when the provider is dropped (best-effort, no panic outside tokio runtime).ctx.stop()triggers service shutdown which stops all runners.- After stop, no containers with label
camel.function.runner=trueshould remain. - If a container leaks (e.g. process killed without graceful shutdown), re-running will create new containers; orphaned ones must be cleaned manually with
docker rm $(docker ps -q --filter label=camel.function.runner=true).
Testing
License
Same as rust-camel.