Question

I Have a SOA App where i want to incorporate some idempotency mechanism on the service layer. I'm using WCF for messaging.

How do you handle idempotency in your apps? do you have some sample code? my goal is to prevent the same message (eg. CreateOrder) to be processed more than once (if configured like that).

Was it helpful?

Solution

idempotency isn't about detecting and stopping a message being processed twice. It has more to do with a message processed 2 or more times has the same side-effects. So rather than Append/Create/Update operations I would just have a Store operation that does both insert and updates.

So in your CreateOrder example just get the client to pass a guid which your service will insert if its does not exist or updates if it does.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top