Idempotence implementation patterns?
629738May 10 2010 — edited May 15 2010Hi,
I have pretty classic usecase - my application consumes messages containing business transactions and based on them mutates a customer wallet. We are on extremely tight deadline, so I am sticking to solutions that are fast to implement, fast to comprehend by the team, I exclude everything funky and complicated. That said, I know Coherence good enough, so it is on the list of the tools I use.
We are trying to implement smart solution that takes care of idempotency, but I have problem finding the right pattern that is simple to implement and offloads the DB. The task is: given (real-world) transactions that have unique ID for which I can get one or more messages, make sure that I process the transaction only once (the first time I get a message) and ignore all subsequent messages. We have settled for a solution that uses unique constraint in the DB, but that means I have synchronous call to the DB for every incoming message and I hate this approach.
With time active customers will accumulate thousands of transactions, so keeping all transaction keys for a customer in-memory is not an option.
I also have no control over the transaction id, It is generated outside of my subsystem.
Hints for solving that in a way that moves the transaction duplication check in the grid?
cheers,
Georgi