Skip to content

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

Notifications You must be signed in to change notification settings

joshdreagan/camel-idempotent-consumer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages