Claus Ibsen created CAMEL-23566:
-----------------------------------

             Summary: camel-jbang - Improve --example to source from 
camel-jbang-examples repository
                 Key: CAMEL-23566
                 URL: https://issues.apache.org/jira/browse/CAMEL-23566
             Project: Camel
          Issue Type: Improvement
          Components: camel-jbang
            Reporter: Claus Ibsen


Currently `camel run --example` only has 3 trivial hardcoded built-in examples 
(timer-log, rest-api, cron-log). Meanwhile, the apache/camel-jbang-examples 
repository has 23+ real-world examples covering circuit-breaker, MQTT, SQL, 
REST/OpenAPI, Keycloak security, XSLT, FTP, AI/LLM, and more.

We should make --example smarter by sourcing examples from the 
camel-jbang-examples repository using a hybrid offline/online approach:

*Catalog index in the examples repo:*
- Add a machine-readable catalog file (e.g., examples-catalog.json) to the root 
of the camel-jbang-examples repository
- Each entry describes: name, title, description, tags, whether it is 
self-contained, required infrastructure, and file list
- This becomes the single source of truth for example metadata

*Hybrid offline/online strategy:*
- At Camel build time: download the catalog JSON and bundle it into the 
camel-jbang JAR. Also bundle a curated subset of simple, self-contained 
examples that work without external infrastructure
- At runtime: --example-list shows the full catalog from the bundled JSON with 
filtering support (by tag/keyword). --example <name> first checks bundled 
examples, then falls back to fetching from GitHub
- Complex examples that require Docker/external services fetch from GitHub on 
demand -- users already need connectivity for those setups anyway

*Benefits:*
- Full catalog always available offline for browsing
- Simple examples work without internet
- Examples repo is the single source of truth -- no duplication in Run.java
- Adding new examples = add directory + update catalog JSON in examples repo
- Easy to keep examples up to date and test them independently

*Future integration points:*
- test-infra support so examples can declare infrastructure requirements
- Doctor/TUI integration to detect if Docker/Podman is available before 
suggesting examples that need containers
- Category/tag filtering for discovery



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to