Skip to content

fix(#9): Add Knative eventing example using Apache Camel - #21

Merged
christophd merged 1 commit into
mainfrom
fix/9-camel-knative-example
Jul 21, 2026
Merged

christophd merged 1 commit into
mainfrom
fix/9-camel-knative-example

Conversation

@christophd

Copy link
Copy Markdown
Member

Summary

Closes #9

Adds a new example module that demonstrates a Quarkus application using Apache Camel to produce CloudEvents to a Knative eventing broker, with a Citrus integration test that runs entirely without a Kubernetes cluster.

What's in the module

Application

  • Routes.java — A Camel route driven by kamelet:timer-source that transforms the message to a CloudEvent via transformDataType("http:application-cloudevents") and posts it to the Knative broker with camel-quarkus-knative-producer.
  • knative.json — Camel Knative environment descriptor. Uses {{k.sink}} as the broker URL placeholder, following the Knative SinkBinding convention.
  • application.properties — Sets camel.component.knative.environment-path=classpath:knative.json.

Test

  • QuarkusApplicationTest.java — Citrus test using ClusterType.LOCAL: Citrus starts a local Jetty HTTP server on localhost:8080 as the broker, then receives and validates the CloudEvent (body, ce-id, ce-type, ce-source, Content-Type).
  • src/test/resources/application.properties — Sets k.sink=http://localhost:8080 so the Camel route posts to the Citrus local broker.

Key design decisions

  • classpath:knative.json instead of file:knative.json so the config resolves correctly from the JAR both in tests and production builds.
  • ClusterType.LOCAL passed explicitly on the createBroker() builder rather than relying on environment variables, making the test portable with zero setup.
  • transformDataType("http:application-cloudevents") is required to make Camel set ce-source=org.apache.camel; without it the source defaults to the route ID.
  • Added camel-kamelets and camel-quarkus-yaml-dsl dependencies — both are needed at runtime to load and execute the timer-source.kamelet.yaml definition.

Validation

  • Module test: Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
  • Full reactor: mvn clean install -DskipTests — all 21 modules pass.

Generated by Bob (IBM) via /oss-fix-issue

Generated by Bob (IBM) via /oss-fix-issue
@christophd
christophd merged commit cd1589a into main Jul 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Knative eventing example using Apache Camel

1 participant