• Add a Comment
  • Edit
  • More Actions v
  • Quarantine this Entry

Comments (2)

1 localhost commented Trackback

[Trackback] Bobby Woolf posted a blog entry called The Message Consumer Rollback Pattern that is suggesting to always process messages transactionally in order to be able to roll back changes when it is not possible to finish processing. It seems logical at firs...

2 localhost commented Permalink

Eugene, I once thought as you did, but I painfully learned otherwise. I don't think that rolling back the transactions was entirely to blame for your problems. Looking at your description, you had an environment where the service provider was corrupting the data. I'm not sure where this service provider was located in relation to MQ, so let's consider two possible scenarios:

1. The service provider participated in the transaction after the message was validated. This is not a case where the resource is down; it's a case where the resource simply doesn't function properly. In that case, you haven't really resolved the problem by eliminating transactions. The data will never get persisted correctly because your resource is corrupting it. You shouldn't be retrying such a transaction (especially not ten times).
2. The service provider corrupted the data before the message was validated. In this case, your validator is to blame. If the message validator isn't catching the corruption, you need to fix it. Once that happens, you can end the transactions (and stop retrying them) before they become problematic. To quote another post in this blog, "The definition of insanity is..."
By removing transactions from the picture, you didn't really solve your basic problem; you just covered it up. You're simply failing 30% faster than before.
When you resolve the actual cause of your problem you will have trouble recovering from those failures because your messages will be in various states. You will have to distinguish between partially-processed messages that need to be "purified" and new messages that can be persisted "as-is." I speak from experience when I say that this is not a trivial task.
If you had rolled back the transactions in their entirety, however, all the messages would be in the same state and you could simply re-process them through your new and improved service provider.
I'm not convinced that exchanging your ability to recover cleanly for the ability to fail faster constitutes a good trade.

Add a Comment Add a Comment