Apache Camel Observability: A Practical Guide
Modern integration applications often connect multiple services, APIs, messaging systems, and databases. As these integrations grow in complexity, monitoring and observability become critical for maintaining application health and troubleshooting issues quickly. Apache Camel provides powerful observability capabilities that help developers monitor route execution, message processing, performance metrics, and distributed tracing. In this guide, we will build a Spring Boot application using Apache Camel and monitor it using Micrometer, Prometheus, and Camel observability capabilities.
1. Introduction
Apache Camel is a popular integration framework that implements Enterprise Integration Patterns (EIPs). While Camel simplifies application integration, production systems require visibility into route behavior, message flow, failures, processing times, and resource consumption. Camel Observability Services provide:
- Route-level monitoring
- Performance metrics collection
- Health checks
- Distributed tracing
- Application insights through Micrometer
- Integration with Prometheus and Grafana
- Production diagnostics
2. Building a Camel Observability Application
2.1 Adding Maven Dependencies
To enable observability in Apache Camel, we first need to configure the required Spring Boot, Camel, Micrometer, and Prometheus dependencies. These libraries provide route monitoring, metrics collection, health checks, and integration with external monitoring tools. Create a Spring Boot project and add the following dependencies to the pom.xml.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.5.0</version>
</parent>
<groupId>com.javatech</groupId>
<artifactId>camel-observability-demo</artifactId>
<version>1.0.0</version>
<properties>
<java.version>21</java.version>
<camel.version>stable__jar__Version</camel.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-micrometer-starter</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
</dependencies>
</project>
This Maven configuration creates a Spring Boot application with Apache Camel integration and observability support. The spring-boot-starter-web dependency enables REST APIs, camel-spring-boot-starter provides Camel runtime functionality, camel-micrometer-starter automatically collects Camel route metrics, spring-boot-starter-actuator exposes monitoring and health endpoints, and micrometer-registry-prometheus publishes application metrics in a format that can be scraped by Prometheus and visualized in Grafana dashboards.
2.2 Creating the Spring Boot Application
The main application class serves as the entry point for the Spring Boot application. It bootstraps the Spring container and automatically initializes all configured Apache Camel routes and observability components.
package com.javatech;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CamelObservabilityApplication {
public static void main(String[] args) {
SpringApplication.run(
CamelObservabilityApplication.class,
args
);
}
}
The @SpringBootApplication annotation enables Spring Boot’s auto-configuration, component scanning, and configuration support. When the application starts, the SpringApplication.run() method creates the application context, registers all Spring beans, initializes Apache Camel routes, and activates observability features such as Micrometer metrics collection and Actuator monitoring endpoints.
2.3 Implementing the REST Controller
To generate traffic that can be monitored by Camel observability services, we expose a REST endpoint that accepts incoming orders and forwards them to a Camel route for processing. This allows us to observe request flow, route execution metrics, and processing performance.
package com.javatech.controller;
import org.apache.camel.ProducerTemplate;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/orders")
public class OrderController {
private final ProducerTemplate producerTemplate;
public OrderController(ProducerTemplate producerTemplate) {
this.producerTemplate = producerTemplate;
}
@PostMapping
public String createOrder(@RequestBody String order) {
producerTemplate.sendBody(
"direct:processOrder",
order
);
return "Order submitted";
}
}
The @RestController annotation marks the class as a REST endpoint, while @RequestMapping("/orders") defines the base URL path. The controller uses Camel’s ProducerTemplate to send incoming order messages to the direct:processOrder endpoint. Whenever a POST request is received, the order payload is forwarded to the Camel route for processing and the client receives an immediate confirmation response. This interaction generates route activity that can be tracked through Micrometer metrics, Actuator endpoints, and Prometheus monitoring.
2.4 Defining the Camel Route
The Camel route contains the business logic that processes incoming orders. It receives messages from the REST controller, performs processing steps, and generates metrics that can be collected and analyzed through Camel observability services.
package com.javatech.route;
import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;
@Component
public class OrderRoute extends RouteBuilder {
@Override
public void configure() {
from("direct:processOrder")
.routeId("order-processing-route")
.log("Received Order: ${body}")
.delay(1000)
.process(exchange -> {
String order =
exchange.getMessage()
.getBody(String.class);
exchange.getMessage()
.setBody(
"Processed : " + order
);
})
.log("Order Processed: ${body}");
}
}
This route starts at the direct:processOrder endpoint and is assigned the unique identifier order-processing-route, which appears in monitoring metrics and dashboards. The route first logs the incoming order, introduces a one-second delay to simulate business processing, and then uses a processor to transform the message content by appending a processing status. Finally, it logs the processed result before completing execution. During each route invocation, Camel automatically records observability data such as exchange counts, processing duration, success and failure rates, throughput, and route health, making it easy to monitor application behavior in production environments.
2.5 Configuring Spring Boot Actuator and Camel Metrics
Spring Boot Actuator and Camel metrics must be configured to expose health information and operational metrics. The following properties enable observability endpoints and allow Prometheus to collect metrics generated by Apache Camel. Add the following configuration in application.properties.
spring.application.name=camel-observability-demo management.endpoints.web.exposure.include=* management.endpoint.health.show-details=always management.prometheus.metrics.export.enabled=true camel.metrics.enabled=true camel.metrics.route-policy-level=all
The spring.application.name property assigns a unique name to the application for identification in monitoring systems. The management.endpoints.web.exposure.include=* setting exposes all Actuator endpoints, while management.endpoint.health.show-details=always provides detailed health information. The management.prometheus.metrics.export.enabled=true property enables Prometheus-compatible metric output. Finally, camel.metrics.enabled=true activates Camel metrics collection and camel.metrics.route-policy-level=all instructs Camel to capture detailed route-level statistics, including exchange counts, processing times, throughput, and route performance data.
2.6 Configuring Prometheus for Metrics Collection
Prometheus is responsible for collecting and storing metrics exposed by the Spring Boot Actuator endpoint. To enable metric scraping, create a Prometheus configuration file that periodically retrieves monitoring data from the application. Create a file named prometheus.yml.
global:
scrape_interval: 15s
scrape_configs:
- job_name: camel-demo
metrics_path: /actuator/prometheus
static_configs:
- targets:
- localhost:8080
This configuration instructs Prometheus to scrape metrics every 15 seconds. The job_name identifies the monitored application, while metrics_path points to the Spring Boot Actuator Prometheus endpoint. The targets section specifies the application instance running on port 8080 from which Prometheus will collect Camel, JVM, and application-level metrics.
2.6.1 Starting the Prometheus Server
After creating the configuration file, start the Prometheus server using the following command. Once started, Prometheus will begin collecting metrics from the configured application endpoint at regular intervals.
prometheus --config.file=prometheus.yml
This command launches Prometheus and loads the specified configuration file. Prometheus continuously polls the application’s /actuator/prometheus endpoint, stores the collected metrics in its time-series database, and makes them available for querying, alerting, and visualization through tools such as Grafana.
2.7 Running the Application and Observing Metrics
After starting the Spring Boot application and Prometheus server, we can invoke the REST endpoint to generate traffic and observe how Apache Camel collects and exposes operational metrics. Each request processed by the Camel route produces log entries, updates route statistics, and contributes to the metrics exposed through Spring Boot Actuator and Prometheus endpoints.
2.7.1 Sending a Test Request
Use the following curl command to submit a sample order to the application. The request is received by the REST controller and forwarded to the Camel route for processing.
curl -X POST http://localhost:8080/orders -H "Content-Type: text/plain" -d "Laptop Order"
If the request is successfully accepted, the application immediately returns a confirmation message to the client while Camel continues processing the order in the background.
Order submitted
The following log entries demonstrate the execution flow of the Camel route. The first log statement records the incoming order, while the second confirms that the order has been processed successfully.
Received Order: Laptop Order Order Processed: Processed : Laptop Order
2.7.2 Health Endpoint Output
The Spring Boot Actuator health endpoint provides information about the application’s operational status. Accessing http://localhost:8080/actuator/health produces output similar to the following.
{
"status": "UP",
"components": {
"diskSpace": {
"status": "UP"
},
"ping": {
"status": "UP"
}
}
}
A status value of UP indicates that the application is healthy and capable of serving requests. Additional components may appear depending on the services and integrations configured within the application. The Actuator metrics endpoint exposes all available application and Camel metrics. Accessing http://localhost:8080/actuator/metrics returns a list of metric names.
{
"names": [
"camel.exchanges.total",
"camel.exchanges.succeeded",
"camel.exchanges.failed",
"http.server.requests",
"jvm.memory.used"
]
}
These metrics provide visibility into Camel route execution, HTTP request activity, JVM performance, memory utilization, and overall application behavior.
2.7.3 Viewing Prometheus Metrics
The Prometheus endpoint exposes detailed metric data in a format that can be scraped and stored by Prometheus. Accessing http://localhost:8080/actuator/prometheus may produce entries similar to the following.
camel_exchanges_total{
routeId="order-processing-route"
}
camel_exchanges_succeeded_total{
routeId="order-processing-route"
}
camel_exchanges_failed_total{
routeId="order-processing-route"
}
camel_route_running{
routeId="order-processing-route"
}
These metrics indicate the total number of route executions, successful exchanges, failed exchanges, and the operational status of the route. As more requests are processed, the metric values increase accordingly and become available for historical analysis.
3. Conclusion
Observability is an essential requirement for modern integration systems. Apache Camel provides powerful observability capabilities through Micrometer, Spring Boot Actuator, Prometheus, and Grafana integration. By enabling Camel metrics and exposing monitoring endpoints, developers gain deep visibility into route performance, message throughput, failures, and overall application health. In this guide, we built a Spring Boot application, enabled Camel observability services, configured Micrometer and Prometheus, exposed operational metrics, and demonstrated how monitoring data can be visualized using Grafana dashboards. These capabilities help teams improve reliability, reduce troubleshooting time, and maintain production-grade integration solutions.




