I have a current situation where I have to design calls to multiple webservices, coming from different companies, let's say EnrollFacebook, EnrollGoogle, EnrollYelp, EnrollBing.
I need to build different options that bundle this enrolls, for instance:
- PlanA: EnrollFacebook, EnrollGoogle, EnrollBing
- PlanB: EnrollGoogle
- PlanC: EnrollYelp, EnrollBing
- PlanD: EnrollFacebook, EnrollGoogle, EnrollYelp, EnrollBing
Later on, if I need to build a PlanE, I want to be able to build using the different units (aka enrolls, and plug google with yelp or whatever).
I'm investigating about a design pattern that helps me covering this, since every enroll is an independent unit, not knowing others enrolls. However if any of the unit fails, I have to call all the deenroll related to all success enrolls.
Do you know a pattern that suit my needs? I was reading about Pipeline or Mediator but not sure if this actually cover what I describe.
Update: I've read this post Choosing the right Design Pattern, but however this does not help since I know what my problem is and I just trying to find an existing solution for this problem since this seems a very common problem, I don't want to reinvent the wheel if there are good designs out there.