开发者

WCF SOAP Idempotent

I might be getting myself confused here but say I want a service to be idempotent. That is, receiving the same request more than once will not change the state of the system. This makes sense to me when receiving messages in a disconnected integration system. For example, receiving messages over MSMQ and having some form of service dealing with the messages being received. You want the service to be in a consistent state even if it receives 10 duplicate messages.

What I am now struggling to get my head around is what about w开发者_如何学编程ith a standard WCF SOAP service that performs CRUD operations. Does the idempotency question only come into affect if it is an asynchronous call? Is a syncrhonous call by nature idempotent? Looking at CRUD operations, the only one which is not idempotent is create. Can you have duplicate create calls to WCF?

Thanks


I guess it would depend on what you define (in your domain) as duplicate. Once that is defined you can then run checks before creating your record. e.g. I have a Person with FirstName, LastName, etc... a duplicate person would be identified by FirstName + LastName.

What kind of duplicate messages would you expect your service to receive? The same client 'clicking the submit button twice'? or two different clients trying to update a record at the same time?


Synchronous or asynchronous does not matter. Think about what if the request is process but before receiving the response the connection is lost. So your client receives an error but the server has processed the request. Update is idempotent because in worst case you update the record twice.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜