I want data to be transfered from point A to point B. I have web services in A and in B. Which design is better?
- A.GetData() :hosted in A, returns data, will be called from B
- B.TakeData(Data pData) :hosted in B, Data passed as parameter, will be called from A
Why approach 1 or 2 is the best way?
You would want to implement Pull
GetData()or PushTakeData()based on how would problem/solution look like in the real world business problem. Very crude example iswhile implementing a fire alarmI would make it push so that I push that information to all the people in the building even if they are not expecting(polling) it hereTakeData()is more suitable. If I want to implementGetEmployeeSalaryI seldom need to blast this information to all the subscribers, since it is sensitive/confidential information I’d want to provide to the people who are asking for it, that too after verifying they are allowed to do so hereGetData()makes more sense.I dont know about the technology you are using, but there should be mechanisms to implement either a push or pull model(atleast WCF has these WS-Eventing).
When Push – Ideally when there is a real world need to update multiple systems/clients with an update. Imagine a stock ticker webservice, and each client is interested in different quotes. It might make sense to send push notifications to the paid clients on every change, about the ticker each client is interested in, while only allowing pull like
GetData()with delayed data for free clients.