Camel Project
You need an Camel Application to monitor. If you don’t have one yet, this guide briefly covers how to create an Apache Camel Project.
π― Quick Decision Matrix:
- Camel JBang: Choose for prototyping, scripting, learning, and quick testing
- Camel Core: Choose when you need full control and traditional Java application architecture
- Camel Quarkus: Choose for cloud-native, microservices, fast startup, low memory footprint
- Camel Spring Boot: Choose for enterprise applications with existing Spring ecosystem
Apache Camel with JBang
Quick Start
Install JBang and Camel CLI:
1
2
3
4
5
6
7
8
| # Install JBang (Linux/macOS)
curl -Ls https://sh.jbang.dev | bash -s - app install --fresh --force jbang
# Install Camel CLI
jbang app install camel@apache/camel
# Create a simple route
camel init MyRoute.java
|
This gives you a simple Route:
1
2
3
4
5
6
7
8
9
10
11
12
| import org.apache.camel.builder.RouteBuilder;
public class MyRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
from("timer:java?period=1000")
.setBody()
.simple("Hello Camel from ${routeId}")
.log("${body}");
}
}
|
Running
1
2
| # Use Camel CLI
camel run MyRoute.java
|
Camel JBang is primary intended to be Camel standalone only but since Camel 4.6 it offers limited support for running with Spring Boot or Quarkus.
Don’t hesitate to run camel --help
as CamelJBang supports multiple commands.
π For complete setup and configuration details, see:
π GitHub Examples:
Apache Camel Core Runtime
Quick Start
Create a new Camel project using Maven archetype:
1
2
3
4
5
6
7
| mvn archetype:generate \
-DgroupId=com.example \
-DartifactId=my-camel-app \
-DarchetypeGroupId=org.apache.camel.archetypes \
-DarchetypeArtifactId=camel-archetype-java \
-DarchetypeVersion=4.4.0 \
-DinteractiveMode=false
|
Simple Example Route
1
2
3
4
5
6
7
8
9
10
11
| // src/main/java/com/example/MyRoute.java
import org.apache.camel.builder.RouteBuilder;
public class MyRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
from("timer:hello?period=5000")
.setBody(constant("Hello from Camel Core!"))
.log("${body}");
}
}
|
π For complete setup and configuration details, see:
π GitHub Examples:
Apache Camel with Quarkus Runtime
Quick Start
Create a new Camel-Quarkus project:
1
2
3
4
5
6
7
8
9
| # Using Quarkus CLI
quarkus create app com.example:my-camel-quarkus-app \
--extension='camel-quarkus-core,camel-quarkus-timer,camel-quarkus-log'
# Or using Maven
mvn io.quarkus.platform:quarkus-maven-plugin:3.8.0:create \
-DprojectGroupId=com.example \
-DprojectArtifactId=my-camel-quarkus-app \
-Dextensions="camel-quarkus-core,camel-quarkus-timer,camel-quarkus-log"
|
Simple Example Route
1
2
3
4
5
6
7
8
9
10
11
12
13
| // src/main/java/com/example/MyQuarkusRoute.java
import org.apache.camel.builder.RouteBuilder;
import jakarta.enterprise.context.ApplicationScoped;
@ApplicationScoped
public class MyQuarkusRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
from("timer:hello?period=5000")
.setBody(constant("Hello from Camel Quarkus!"))
.log("${body}");
}
}
|
Running
1
| mvn quarkus:dev # Development mode with hot reload
|
π For complete setup and configuration details, see:
π GitHub Examples:
Apache Camel with Spring Boot
Quick Start
Create a new Camel Spring Boot project:
1
2
3
4
5
6
7
8
| # Using Maven archetype
mvn archetype:generate \
-DgroupId=com.example \
-DartifactId=my-camel-spring-boot-app \
-DarchetypeGroupId=org.apache.camel.archetypes \
-DarchetypeArtifactId=camel-archetype-spring-boot \
-DarchetypeVersion=4.4.0 \
-DinteractiveMode=false
|
Simple Example Route
1
2
3
4
5
6
7
8
9
10
11
12
13
| // src/main/java/com/example/MySpringBootRoute.java
import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;
@Component
public class MySpringBootRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
from("timer:hello?period=5000")
.setBody(constant("Hello from Camel Spring Boot!"))
.log("${body}");
}
}
|
Running
π For complete setup and configuration details, see:
π GitHub Examples: