Skip to content
An example project showing how to do idempotent consumption in Camel as a viable replacement for XA transactions.
Branch: master
Clone or download
Latest commit 2d300df Aug 11, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore first commit Aug 11, 2017
README.md
pom.xml

README.md

camel-idempotent-consumer

An example project showing how to do idempotent consumption in Camel as a viable replacement for XA transactions.

Requirements

Preparing

Install and run MySQL [https://dev.mysql.com/doc/refman/5.7/en/installing.html]

Note: For my tests, I chose to run the docker image [https://hub.docker.com/r/mysql/mysql-server/]. You can run it using the command docker run --name mysql -e MYSQL_DATABASE=example -e MYSQL_ROOT_PASSWORD=Abcd1234 -e MYSQL_ROOT_HOST=172.17.0.1 -p 3306:3306 -d mysql/mysql-server:5.7. You can then connect and run SQL statements using the command docker exec -it mysql mysql -uroot -p.

Build the project source code

$ cd $PROJECT_ROOT
$ mvn clean install

Running the example standalone

$ cd $PROJECT_ROOT
$ mvn spring-boot:run

Testing the code

There are a couple of test files in the src/test/data folder. You can drop them in the target/messages folder to kick off the route.

$ cd $PROJECT_ROOT
$ cp src/test/data/message_01.txt target/messages/

If the file successfully processed, you will see the message in the DB only once. You can check it using the SQL command select * from example.MESSAGES;. You will also see a single copy in the target/processed folder.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.