lundi 15 janvier 2018

Design pattern to prevent duplicate events triggering

I have a few events in my application like generating offers, sending emails, push notifications etc. Recently due to a bug we ended up with sending duplicate push messages to our users. Is there a design pattern which we can follow to prevent such situation in future.

If not a design pattern what is the best solution to handle this. We are thinking to prepare a central repository in DB / cache for all the triggered events and also prepare some business rules like defining max limit per day/hour/user etc and apply a check before triggering any new event to validate if it passes the business rules. Is this looks a good solution? I am concerned with the performance lag it may introduce.

FYI - We have spring mvc application using PostgreSql database and Redis cache

Aucun commentaire:

Enregistrer un commentaire