Duplicate action detection and correct response

To prevent any action from being duplicated due to communication errors at the first try it is needed to identify the first communication with an id that the server has to verify to not duplicate the action.

The common case is like this:

A client sends a communication to a server requesting a new order. The communication has an orderid. The server gets all the info and performs the action. But that communication fails to get a response because of a network problem like loss of connectivity. Since the client is not sure the communication was totally OK the client must retry back the communication. Since the communication has an orderid there is no problem in sending it again (no risk of duplication). Since the server already performed the action, this second time the response code should be either just the same as the first case "OK - accepted" (for simplicity) or "OK - already accepted". It is critical this response be understood by the client as OK, otherwise the client will retry forever.

I am explaining this because I have had problems trying to make understand people about this problems that made some orders, although correctly sent to the server, never marked as OK on the client system and thus retried forever making the user unhappy since his order was like not being sent.

No comments: