6.7. Idempotent Operations

A message is guaranteed to be persisted when the message sent to a persistent destination returns with no exception.
An exception does not guarantee the message was not persisted, because failure may have occurred between the message being persisted and a response being returned to the caller.
Applications must therefore be coded so that operations are idempotent — that is, operations can be repeated without causing the system to become inconsistent.
You can implement this behaviour on the application level by checking for duplicate messages and discarding them if the original message has been sent successfully. This duplicate checking is a powerful technique that can remove the need for XA transactions.
JBoss Messaging is configured by default to perform duplicate checking in a clustered environment.