samedi 3 avril 2021

Best Backend Python Design pattern to use to send emails

I am developing an email feature into the Backend of an app which sends a different email with a different template depending on a set() of triggers. Each trigger returns a status of True or False. When False, an email is supposed to be sent out which depends on that particular trigger which returned False. What is the best design pattern, light, scalable, reusable to use for this feature, which i could easily extend to more triggers? Would it be the observer pattern?
decorator? match case? something else?

trigger 1(args) => email( args ){template1(args)} 
trigger 2(args) => email( args ){template2(args)} 
trigger 3(args) => email( args ){template3(args)} 
trigger 4(args) => email( args ){template4(args)} 

Aucun commentaire:

Enregistrer un commentaire