camel-cli 0.35.0

Command-line interface for Apache Camel in Rust
docs.rs failed to build camel-cli-0.35.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: camel-cli-0.30.0

camel-cli

Command-line interface for Apache Camel in Rust.

Installation

cargo install camel-cli

Usage

camel <COMMAND>

Commands:
  new      Scaffold a new Camel project
  run      Start a Camel context from route files (YAML or JSON) with hot-reload
  journal  Inspect a runtime journal file
  plugin   Manage WASM plugins (processors and beans)
  openapi  Generate OpenAPI document from REST route files
  help     Print help

Options:
  -h, --help     Print help
  -V, --version  Print version

camel new

Scaffolds a new project directory with a Camel.toml, routes/hello.yaml, README.md, and .gitignore.

camel new <NAME>

Arguments:
  <NAME>  Project name and directory to create

Command-line interface for Apache Camel in Rust.

Options:
  --template <TEMPLATE>       Template to use (default: basic)
  --profile-layout <LAYOUT>   Profile layout: simple or env (default: env)
  --force                     Overwrite files if the directory already exists

Examples

# Create a project with default (env) profile layout
camel new my-integration

# Single-profile layout (no development/production sections)
camel new my-integration --profile-layout simple

# Overwrite an existing directory
camel new my-integration --force

Generated layout

my-integration/
├── Camel.toml          # Route patterns, log level, watch, profiles
├── README.md
├── .gitignore
└── routes/
    └── hello.yaml      # Timer route that logs every 2s

Then run it:

cd my-integration
camel run

camel run

Starts a Camel context and loads routes from YAML or JSON files. Hot-reload is disabled by default — enable it with --watch or via Camel.toml.

camel run [OPTIONS]

Options:
   --routes <GLOB>   Glob pattern for route files (default examples use YAML; explicit .json globs also supported)
   --config <FILE>   Path to Camel.toml (default: Camel.toml)
   --watch           Enable file-watcher hot-reload
   --no-watch        Disable file-watcher hot-reload (overrides Camel.toml)
   --health-port <PORT>  Override health server port (enables standalone health server)
   --otel                Enable OpenTelemetry export (traces, metrics, logs)
   --otel-endpoint <URL>  OTLP endpoint URL (implies --otel)
   --service-name <NAME>  OTel service name (implies --otel)

Quick start — no config file

# Runs routes/*.yaml without hot-reload
camel run --routes "routes/*.yaml"

# Same but with hot-reload enabled
camel run --routes "routes/*.yaml" --watch

With a Camel.toml

Create a Camel.toml next to your route files:

[default]
routes = ["routes/**/*.yaml"]
log_level = "INFO"
watch = false

[default.supervision]
max_attempts = 5
initial_delay_ms = 1000
backoff_multiplier = 2.0
max_delay_ms = 60000

[development]
log_level = "DEBUG"
watch = true

[production]
log_level = "ERROR"
watch = false

Then run:

camel run
# or with an explicit profile (development enables watch = true):
CAMEL_PROFILE=development camel run
# or force watch regardless of profile:
camel run --watch

The --routes flag overrides whatever routes is set to in the config file. --watch / --no-watch override the watch field in Camel.toml.

Hot-reload

Hot-reload is off by default. Enable it with --watch, or set watch = true in the active profile of Camel.toml:

[development]
watch = true
CAMEL_PROFILE=development camel run   # watch ON via profile
camel run --watch                      # watch ON via flag
camel run --no-watch                   # watch OFF, overrides Camel.toml

Health

camel run routes/*.yaml --health-port 8080

While the watcher is active, edit any watched YAML file and save — the route diff is computed and applied within ~300 ms:

Change Effect
Edit pipeline steps Atomic swap_pipeline — zero downtime
Add a new route Route compiled and started
Delete a YAML file Corresponding routes stopped and removed

Route YAML format

routes:
  - id: "my-route"
    from: "timer:tick?period=1000"
    steps:
      - log: "message=Hello from ${routeId}"
      - to: "mock:out"

See camel-dsl for the full step reference.

Graceful Shutdown

Press Ctrl+C to stop the Camel context:

  • First Ctrl+C: initiates graceful shutdown — stops routes, cleans up bridge processes (JMS, CXF, XSLT, XJ, Validator), then exits.
  • Second Ctrl+C: force-exits immediately (exit(1)). Use only if shutdown hangs.

Bridge pool shutdowns have a 30-second timeout. If a pool doesn't shut down within that window, a warning is logged and the process continues.

Bridge health monitors are stopped before route shutdown to prevent restart loops during the shutdown sequence.

camel test

Runs declarative mock tests from *.test.yaml documents. Each document boots a lean CamelContext in-process, loads its routes, delivers direct: inputs, settles traffic, and asserts expectations against the real mock component.

camel test <FILE|DIR>...   # test documents, or directories expanded recursively

Test document format

A test document declares a route source, optional inputs, and mandatory expectations:

routeFiles: [config/routes.yaml]   # OR inline `routes:` (same schema as route files)
inputs:                            # optional; omitted ⇒ routes must self-start (timer)
  - to: "direct:start"             # direct: scheme only
    body: "hello"
    headers: {kind: greeting}
expects:                           # mandatory, ≥ 1 endpoint
  mock:result:
    count: 1                       # exact count
    minCount: 1                    # or minimum count (mutually exclusive with count)
    bodies: ["hello"]              # ordered expected bodies
    headers: {kind: greeting}      # expected headers
settle: "500ms"                    # optional quiet window (0 < settle <= 5s)
  • Route source: exactly one of routeFiles (paths resolved relative to the test document's directory), routeFilesFromRoot (paths resolved against the nearest ancestor Camel.toml directory), or inline routes (same schema as route files). More than one or none is an error.
  • Inputs: inputs.to accepts direct: endpoints only. Bodies are string, object, or array; null/boolean/number scalars are rejected.
  • Expects: keys are mock:-prefixed endpoint URIs (mock:result); the runner normalizes to the bare name (result). count and minCount are mutually exclusive per endpoint. settle is a humantime string ("500ms", "2s") within 0 < settle <= 5s.
  • Unknown fields are rejected.

Exit codes

Code Meaning
0 Every expectation of every document passed
1 Any expectation failed or a settle timeout occurred
2 Misuse, unreadable file, or document/route parse error

When classes coexist, precedence is 2 > 1 > 0 (a broken suite outranks an assertion failure). stdout carries one PASS/FAIL line per endpoint per document plus a final N passed, M failed summary.

Non-interference with camel run

camel test does not change route files or camel run behavior. Route discovery (initial load and watch reload) skips *.test.yaml and *.test.yml camel test documents on every pattern path: the default glob, Camel.toml routes, and --routes. Naming a test document literally, with no wildcards, fails with a reserved-suffix error pointing at camel test. Wildcard matches are skipped, so a glob matching only test documents yields no routes.

Example

See examples/yaml-dsl/config/mock-demo.test.yaml for a runnable example paired with its route file.

Configuration reference

Key Type Default Description
routes [String] [] Glob patterns for route files (default examples use YAML; explicit .json globs are also supported)
watch bool false Enable file-watcher hot-reload
runtime_journal_path String? disabled Optional flag to enable local runtime durability/replay
log_level String "INFO" Tracing log level
timeout_ms u64 5000 Default operation timeout (ms)
components.timer.period u64 1000 Default timer period (ms)
components.http.connect_timeout_ms u64 5000 HTTP connect timeout (ms)
components.http.max_connections usize 100 HTTP connection pool size
observability.metrics_enabled bool false Enable metrics endpoint
observability.metrics_port u16 9090 Metrics server port
observability.health.enabled bool false Enable standalone health server
observability.health.port u16 8080 Health server port
supervision.max_attempts u32? 5 Max route restart attempts (null = unlimited)
supervision.initial_delay_ms u64 1000 Initial restart delay (ms)
supervision.backoff_multiplier f64 2.0 Backoff multiplier per retry
supervision.max_delay_ms u64 60000 Max restart delay cap (ms)

Environment variable overrides use the CAMEL_ prefix, e.g. CAMEL_LOG_LEVEL=DEBUG.

Example

See examples/camel-cli-run for a ready-to-run project layout with a Camel.toml and example routes.

License

Apache-2.0

camel plugin

Manage WASM plugins for the Camel runtime.

camel plugin new

# Create a processor plugin (default)
camel plugin new my-processor

# Create a bean plugin
camel plugin new my-bean --type bean

# Create an authorization-policy plugin
camel plugin new my-policy --type authorization-policy

# Force overwrite existing directory
camel plugin new my-plugin --force

Each generated plugin includes a README.md with a Camel.toml example showing how to register the plugin and (for beans and authorization policies) how to tune the optional [limits] block (timeout-secs, max-memory, max-concurrent-calls). See docs/adr/0014-wasm-plugin-config-unification.md for the runtime configuration model.

camel plugin build

Compiles the plugin to wasm32-wasip2:

cd my-plugin
camel plugin build