Chapter 9. Using transactions

 

This chapter covers

  • Why you need transactions
  • How to use and configure transactions
  • The differences between local and global transactions
  • How to return custom reply messages on rollback
  • How to compensate when transactions aren’t supported

To help explain what transactions are, let’s look at an example from real life. You may well have ordered this book from Manning’s online bookstore, and if you did, you likely followed these steps:

  1. Find the book Camel in Action
  2. Put the book into the basket
  3. Maybe continue shopping and look for other books
  4. Go to the checkout
  5. Enter shipping and credit card details
  6. Confirm the purchase
  7. Wait for the confirmation
  8. Leave the web store

What seems like an everyday scenario is actually a fairly complex series of events. You have to put books in the basket before you can check out; you must fill in the shipping and credit card details before you can confirm the purchase; if your credit card is declined, the purchase won’t be confirmed; and so on. The ultimate resolution of this transaction is either of two states: either the purchase was accepted and confirmed, or the purchase was declined, leaving your credit card balance uncharged.

This particular story involves computer systems because it’s about using an online bookstore, but the same main points happen when you shop in the supermarket. Either you leave the supermarket with your groceries or without.

9.1. Why use transactions?

9.2. Transaction basics

9.3. The Transactional Client EIP

9.4. Configuring and using transactions

9.5. Compensating for unsupported transactions

9.6. Summary and best practices

sitemap