This project is a learning and training microservice for Apache Camel, designed to practice and understand the fundamental concepts of integration using Apache Camel with Quarkus.
This project contains a series of practical exercises covering basic and advanced Apache Camel concepts, including:
- Basic components (Timer, Direct)
- Message processing
- Data transformation
- RabbitMQ integration
- Enterprise Integration Patterns (EIPs)
- Java 21
- Quarkus 3.8.6 - Supersonic Subatomic Java Framework
- Apache Camel - Enterprise integration framework
- RabbitMQ - Message broker for asynchronous messaging
- Maven - Dependency management and build tool
Before running this project, make sure you have installed:
- Java 21 or higher
- Maven 3.8+
- RabbitMQ (optional, only for exercises using messaging)
For exercises that use RabbitMQ, you need to have a RabbitMQ server running. You can use Docker/Podman:
# Using Podman
podman run -d --name rabbitmq-got -p 5672:5672 -p 15672:15672 docker.io/library/rabbitmq:3-management
# Or using Docker
docker run -d --name rabbitmq-got -p 5672:5672 -p 15672:15672 rabbitmq:3-managementDefault credentials:
- Username:
guest - Password:
guest - Web interface: http://localhost:15672
Development mode enables hot reload and is ideal for learning and experimenting:
./mvnw quarkus:devOnce started, the application will be available and you can see the exercise logs in real-time.
Note: Quarkus includes a Dev UI available in development mode at: http://localhost:8080/q/dev/
To package the application:
./mvnw packageThis produces the quarkus-run.jar file in the target/quarkus-app/ directory. To run it:
java -jar target/quarkus-app/quarkus-run.jarTo create a native executable:
./mvnw package -DnativeOr using a container (if you don't have GraalVM installed):
./mvnw package -Dnative -Dquarkus.native.container-build=truesrc/main/java/co/com/fduenasc/
βββ Exercise1Router.java # Exercise 1: Timer component
βββ Exercise2Router.java # Exercise 2: Direct endpoint and log component
βββ Exercise3Router.java # Exercise 3: Custom Processor
βββ GameOfThronesRouter.java # Advanced example: RabbitMQ integration
βββ RabbitMQConfiguration.java # RabbitMQ configuration
βββ TrainingRouter.java # Basic training router
File: Exercise1Router.java
- Objective: Learn to use Apache Camel's
timercomponent - Concepts: Timer component, Exchange, Processors
- Functionality: Prints sequential numbers every 3 seconds
To see it in action: Start the application and observe the logs every 3 seconds.
File: Exercise2Router.java
- Objective: Learn to use
directendpoints and thelogcomponent - Concepts: Direct endpoint, Log component, Route ID
- Functionality: Reads messages from
direct:startand prints them to console
To test it: Send a message to the direct:start endpoint from another route or using ProducerTemplate.
File: Exercise3Router.java
- Objective: Create a custom Processor to transform messages
- Concepts: Custom Processor, Data transformation, Exchange manipulation
- Functionality: Transforms text to uppercase using a custom Processor
To test it: The route includes a test example that runs automatically on startup.
File: GameOfThronesRouter.java
- Objective: Complete example of RabbitMQ integration
- Concepts: RabbitMQ integration, JSON marshalling, Split EIP
- Functionality: Sends JSON messages with Game of Thrones characters to RabbitMQ
Requirements: RabbitMQ must be running (see installation section).
RabbitMQ configuration is located in src/main/resources/application.properties:
rabbitmq.host=localhost
rabbitmq.port=5672
rabbitmq.username=guest
rabbitmq.password=guestYou can modify these values according to your environment.
The project uses the following Camel Quarkus extensions:
camel-quarkus-core- Camel core functionalitycamel-quarkus-timer- Timer componentcamel-quarkus-direct- Direct componentcamel-quarkus-spring-rabbitmq- RabbitMQ integrationcamel-quarkus-jackson- JSON processing
All exercises generate logs that you can see in the console. Look for messages like:
INFO [co.com.fduenasc.Exercise1Router] NΓΊmero secuencial: 0
INFO [co.com.fduenasc.Exercise3Router] Texto transformado a mayΓΊsculas: HOLA MUNDO
If you're using exercises with RabbitMQ, you can access the management interface:
- URL: http://localhost:15672
- Username: guest
- Password: guest
From here you can:
- View created exchanges and queues
- Monitor messages
- View connection statistics
- Route: Defines the message processing flow
- Endpoint: Entry or exit point of a route
- Exchange: Container for the message in transit
- Processor: Component that processes the Exchange
- EIP (Enterprise Integration Patterns): Enterprise integration patterns
# Check if the container is running
podman ps | grep rabbitmq
# If it's stopped, start it
podman start rabbitmq-got
# Check the logs
podman logs rabbitmq-got- Verify that RabbitMQ is running
- Make sure the exchange and queue are created (they are created automatically on startup)
- Check application logs for connection errors
Make sure the camel-quarkus-direct extension is in the pom.xml:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-direct</artifactId>
</dependency>- This project is designed for learning and training
- Exercises are progressive: start with Exercise 1 and advance sequentially
- Experiment by modifying the routers to better understand how Apache Camel works
- Logs are your best friend to understand message flow
This is a learning project. Feel free to:
- Experiment with the exercises
- Add new exercises
- Improve documentation
- Share your learnings
This project is for educational and training purposes.
Happy learning with Apache Camel! πͺ