|
| 1 | +# Apache Camel Quarkus Examples - AI Agent Guidelines |
| 2 | + |
| 3 | +Guidelines for AI agents contributing examples to **apache/camel-quarkus-examples**. |
| 4 | + |
| 5 | +This repository contains runnable example applications that demonstrate Apache |
| 6 | +Camel running on [Quarkus](https://quarkus.io/), in JVM and native mode. |
| 7 | + |
| 8 | +For the canonical, project-wide agent rules, see the Camel Quarkus |
| 9 | +[`AGENTS.md`](https://github.com/apache/camel-quarkus/blob/main/AGENTS.md). |
| 10 | +The notes below adapt the essentials to this examples repository — note that |
| 11 | +Camel Quarkus follows GitHub-based conventions that differ from Apache Camel |
| 12 | +core (e.g. GitHub issues instead of JIRA). |
| 13 | + |
| 14 | +## Project Info |
| 15 | + |
| 16 | +- Build: Maven 3.9+ (use the provided `./mvnw` wrapper) |
| 17 | +- Java: 17+ (CI also exercises JDK 21) |
| 18 | +- BOMs: `quarkus-bom` + `quarkus-camel-bom` (extension versions are inherited, |
| 19 | + never pinned per-dependency) |
| 20 | +- Tests: `@QuarkusTest` (JVM) and `@QuarkusIntegrationTest` (packaged/native) |
| 21 | +- Issue tracker: **GitHub issues** at https://github.com/apache/camel-quarkus/issues |
| 22 | + (Camel Quarkus does **not** use JIRA) |
| 23 | + |
| 24 | +## Rules of Engagement (essentials) |
| 25 | + |
| 26 | +- **Attribution**: every AI-generated PR description, review or issue comment MUST |
| 27 | + identify itself as AI-generated and name the human operator, e.g. |
| 28 | + `_Claude Code on behalf of [Human Name]_`. |
| 29 | +- **Target the `camel-quarkus-main` branch** for PRs (it tracks the current |
| 30 | + Camel Quarkus SNAPSHOT), as stated in the repository's PR template. The `main` |
| 31 | + branch tracks the latest released Quarkus Platform. |
| 32 | +- **One example per PR**, kept small and self-contained. Do not exceed 10 PRs per |
| 33 | + day per operator. Quality over quantity. |
| 34 | +- **Branch from your own fork** (not apache/), with a descriptive name (include |
| 35 | + the GitHub issue number when there is one, e.g. `123-rest-json-example`). |
| 36 | + Delete the branch after merge/close. Never push to a branch you did not create. |
| 37 | +- **Green CI is required**, including license/format/import checks and (where |
| 38 | + applicable) the native build. |
| 39 | +- **Never merge** without at least one human approval; never approve your own PR. |
| 40 | + |
| 41 | +## Repository structure |
| 42 | + |
| 43 | +- A root aggregator `pom.xml` (packaging `pom`) lists every example under |
| 44 | + `<modules>`. Each example, however, is **parentless and standalone** — it |
| 45 | + declares no `<parent>` and imports the Quarkus + Camel Quarkus BOMs directly, |
| 46 | + so it can be built on its own. |
| 47 | + |
| 48 | +## Anatomy of an example |
| 49 | + |
| 50 | +``` |
| 51 | +<example>/ |
| 52 | +├── README.adoc # AsciiDoc: dev, package, native commands |
| 53 | +├── pom.xml # imports quarkus-bom + quarkus-camel-bom |
| 54 | +├── src/main/java/org/acme/... # *Route.java (extends RouteBuilder, @ApplicationScoped) |
| 55 | +│ # beans (@ApplicationScoped / @Named) |
| 56 | +├── src/main/resources/ |
| 57 | +│ ├── application.properties # Quarkus + Camel config (ASF header) |
| 58 | +│ └── camel/*.yaml # optional YAML DSL routes |
| 59 | +└── src/test/java/org/acme/... # @QuarkusTest / @QuarkusIntegrationTest |
| 60 | +``` |
| 61 | + |
| 62 | +- Beans reached reflectively (e.g. via the `bean` component) may need |
| 63 | + `@RegisterForReflection` so they work in native mode. |
| 64 | + |
| 65 | +## Build, run and validate |
| 66 | + |
| 67 | +```bash |
| 68 | +# dev mode with live reload |
| 69 | +mvn clean compile quarkus:dev |
| 70 | + |
| 71 | +# JVM package + run |
| 72 | +mvn clean package |
| 73 | +java -jar target/quarkus-app/quarkus-run.jar |
| 74 | + |
| 75 | +# native build + run (needs GraalVM or the container builder) |
| 76 | +mvn clean package -Dnative |
| 77 | +./target/*-runner |
| 78 | + |
| 79 | +# tests |
| 80 | +mvn clean test |
| 81 | + |
| 82 | +# license / formatting / imports (run before pushing) |
| 83 | +mvn license:check formatter:validate impsort:check |
| 84 | +``` |
| 85 | + |
| 86 | +CI validates platform compatibility (`cq:examples-check-platform`), license and |
| 87 | +formatting, compilation, tests, and native builds (Linux/Windows, JDK 17/21). |
| 88 | + |
| 89 | +## Conventions |
| 90 | + |
| 91 | +- **Maven coordinates**: `groupId` = `org.apache.camel.quarkus.examples`; |
| 92 | + `artifactId` = `camel-quarkus-examples-<name>` (matches the directory). |
| 93 | +- **Java package**: `org.acme.<domain>.<feature>` (e.g. `org.acme.timer.log`). |
| 94 | +- **License headers**: 13-line ASF header on every `.java`, `.xml`, |
| 95 | + `.properties`, `.groovy` (template in `header.txt`), enforced by the license |
| 96 | + plugin. |
| 97 | +- **Config**: inject with MicroProfile `@ConfigProperty(name = "...")` and back |
| 98 | + it with keys in `application.properties`. |
| 99 | +- **README**: AsciiDoc, with `Start in Development mode`, `Package and run`, and |
| 100 | + (where relevant) native sections, plus a Feedback section. |
| 101 | + |
| 102 | +## Adding a new example (checklist) |
| 103 | + |
| 104 | +1. Scaffold the example with the Camel Quarkus Maven mojo — it creates the |
| 105 | + module and registers it in the root aggregator `pom.xml`: |
| 106 | + ```bash |
| 107 | + mvn org.l2x6.cq:cq-maven-plugin:create-example \ |
| 108 | + -Dcq.artifactIdBase="yaml-to-log" \ |
| 109 | + -Dcq.exampleName="YAML To Log" \ |
| 110 | + -Dcq.exampleDescription="Shows how to use a YAML route with the log EIP" |
| 111 | + ``` |
| 112 | +2. Implement the routes/beans under `org.acme.<domain>.<feature>`, configure |
| 113 | + `application.properties`, add tests, and complete the generated `README.adoc`. |
| 114 | +3. Verify locally: `mvn clean test`, `mvn quarkus:dev`, and — if the example is |
| 115 | + expected to — `mvn clean package -Dnative`. |
| 116 | +4. Run `mvn license:check formatter:validate impsort:check`. |
| 117 | +5. Open the PR from your fork **against `camel-quarkus-main`**, reference the |
| 118 | + GitHub issue (if any), and request review from active committers. |
| 119 | + |
| 120 | +## Links |
| 121 | + |
| 122 | +- Camel Quarkus user guide: https://camel.apache.org/camel-quarkus/latest/user-guide/index.html |
| 123 | +- Create a new example (contributor guide): https://camel.apache.org/camel-quarkus/latest/contributor-guide/create-new-example.html |
| 124 | +- Canonical agent rules: https://github.com/apache/camel-quarkus/blob/main/AGENTS.md |
0 commit comments