dimanche 11 décembre 2016

RabbitMQ model for "is anyone listening able to process this?"

I have two webservers and multi-master MySQL database behind them. I'm trying to avoid a race condition by using RabbitMQ, and I'm not sure how I should be setting up the exchange/queue. I hope someone can point me in the right direction:

When we get the race condition, User is on WWW1, creates a record for a purchase on WWW1 (via a load balancer), and we send them off-site to process their payment. The third-party payment processor calls the load balancer which directs it to WWW2 to update the record with payment information. Sometimes WWW2's database server hasn't gotten the replication updates from WWW1's database server, and it can't process the payment. This is when everything falls apart.

I would like to have the method that processes the payment simply tell RabbitMQ that "Transaction 12345 has been paid" and have subscribers attached to both databases try to see if they can process the message (it's OK if they both do), and for that method to know whether or not any subscriber could process the payment information or not.

Aucun commentaire:

Enregistrer un commentaire