This question is mostly about the best way to approach this problem. Any input is appreciated.
The Problem
In my application i need to send some data to a number of different destinations (we will call them receivers from now on) using different protocols (http post, ftp, soap services). Each of the different receivers respond differently and some processing needs to be done on each response to work out what happened. This response processing can become quite complex.
My application also needs to do take different actions based on the receiver.
My Solution
My plan is to create a separate class for each receiver that implements an interface and use Factory design pattern to decide which class to load based on the receiver. Each receiver has a unique name (which is stored in the database for other reasons) which i plan to use to decide which receiver to load. I'll pass this to the factory constructor.
Currently i plan to have my interface implement these methods
- prepareData()
- sendData()
- handleResult()
I'd also like a wrapper for these function such as process() which would just return a boolean based on wether the send sent. I'm not sure where i would fit this in though.
Thanks