Since I’ve been contributing to the project for the past months, I thought it’d be a good time to write a post that explores the rationale behind the project and some its core features.
Camel Quarkus Project
Camel Quarkus provides Quarkus extensions for many of the Camel components. At present around 180 components have extensions with more planned in the future.
Camel Quarkus also takes advantage of the many performance improvements made in Camel 3, which results in a lower memory footprint, less reliance on reflection (which is good for native application support) and faster startup times.
You can define Camel routes using the Java DSL, XML & Kotlin.
Fast startup & low RSS memory
Taking advantage of the build time and ahead-of-time compilation (AOT) tricks that Quarkus gives us, much of the Camel application can be pre-configured at build time resulting in fast startup times.
Camel Quarkus is part of the wider Quarkus universe and thus its component extensions are available to select from code.quarkus.io.
Native executable support
All of the important aspects of a Camel Quarkus application can be set up programatically with CDI or via configuration properties. By default, a
CamelContext is configured and automatically started for you.
Check out the bootstrap & configuration guide for more information on the different ways to bootstrap & configure an application.
Some extensions can automagically configure various aspects of Camel for you (a bit like Spring Boot auto configuration). For example, the MongoDB extension ensures a Mongo client bean is added to the registry for the Mongo component to use.
Integrates with existing Quarkus extensions
Quarkus provides extensions for libraries and frameworks that are used by some camel components, so it makes sense to reuse these and inherit the native support and configuration options.
Health & liveness checks
All configured checks are available on the standard MicroProfile Health endpoint URLs:
There’s an example project which demonstrates health checks:
Camel provides a MicroProfile Metrics component which is used to integrate with Quarkus MicroProfile Metrics. Some basic Camel metrics are provided for you out of the box, and these can be supplemented by configuring additional metrics in your routes.
Metrics are available on the standard MicroProfile metrics endpoint:
Camel Quarkus integrates with the Quarkus OpenTracing extension. All you need to do is set up the required configuration properties and an
OpenTracingTracer will get automatically added to the registry for Camel to use.
There’s an example project demonstrating the above features here:
What if there’s no extension for my favourite Camel component?
Fear not! Most Camel components if added manually to your project should run without any issues in JVM mode. However, some components may not work out of the box in native mode. In this case, feel free to raise an issue requesting an extension for the camel component.
Here’s a very basic example of quickly bootstrapping a Camel Quarkus application that uses the timer and log component extensions. We’ll also use Camel Main as our preferred bootstrap method.
First generate the project skeleton. We’ll use Maven, but you could also use code.quarkus.io.
This creates a new project in the directory
timer-to-log-test. In the generated
pom.xml you’ll see that the requested Camel component extensions have been added:
Next we’ll add a simple route that prints a log message generated from a timer endpoint:
Notice we used a placeholder value for the
period on the timer endpoint. To demonstrate integration with Quarkus configuration, lets add an option to
src/main/resources/application.properties. We’ll also add some configuration for the log component:
To run the application in development mode do:
Every 5 seconds you’ll see a log message output to the console:
To demonstrate the hot reload feature of Quarkus, adjust the exchange body like:
Save the changes & the application will reload and print the new message.
Before generating a native executable for the application, make sure you have fulfilled the prerequisites outlined in the Quarkus documentation. Then do:
When the process has finished you can run:
We only scratched the surface of what’s possible with Camel Quarkus. Some other topics to explore and experiment with are:
- Creating a container image for your application
- Deploying to Kubernetes or OpenShift with the Quarkus Kubernetes extension
- Testing with Quarkus JUnit. Also check out the Camel Quarkus integration tests.
- Try out some of the Camel Quarkus example projects
Hopefully that was a nice overview of what Camel Quarkus has to offer. More component extensions & features will be added in future releases.
If you have feedback or you’d like to contribute, check out the contributors guide:
The source code is available on GitHub:
The Camel Quarkus team is on Zulip for chat:
We also lurk in the Quarkus Zulip room:
There’s also the Camel mailing lists: