I have been reading about the composite pattern but I don't know if fits in my problem, actually I need to manage a hierarchy of events like, for example, send an email, send SMS, and of course, these events could have children. The thing is I need to run in parallel tasks according to the answer of the first "node" and so on. they depend on each other at the flow level but the process of executing the tasks is independent.
I attached an example of what do I need.
- The first task is to send the email to 100 people.
- The tree hierarchy allows conditional events. So in this case I added a conditional that verify if the email was successful. At this point, I need to check in my analytics which people receive the email. So assuming that 25 received the email and 75 not received the email.
- The last step is to send an email to the 25 who receive the email and for the other 75 an SMS will be sent to them (Those tasks have to run parallel).
Do composite patterns could fix this problem? I mean I don't want to "hack" the pattern, even I was planning to use it with a chain of responsibility but maybe the parallel task could corrupt the CoR pattern.
Aucun commentaire:
Enregistrer un commentaire