This forum has been archived. Please start a new discussion on GitHub.

Tips to achieve exactly-once semantics?


I use Ice and glacier2 to transport alerts from clients to a server. We all know that Ice provides "at-most-once" semantics for delivering messages.

I can easily get "at-least-once" semantics by re-queuing every message that produced an Ice::TimeoutException.

Is there a clever way to get "exactly-once" semantics? Using "at-least-once" semantics and filtering out duplicate messages at the server does not sound clever to me.



  • matthew
    matthew NL, Canada
    What is the problem you want to solve? Is it if you send the request and get a failure (ie: an exception) you want to know whether the request was actually executed by the server?
  • Yes, that might help. This is only an issue if the network is really bad and connections are lost on a regular basis.

    Currently, I re-queue the message if a TimeoutConnection was thrown. But this results naturally in duplicated messages in networks with poor connectivity. I would like to get rid of the duplicated messages. Do you have any advice?
  • benoit
    benoit Rennes, France

    The only way to avoid the duplicated messages is to add support for it in the server. Either the server drops duplicated messages or it provides an interface for the client to query whether or not a given request was dispatched. Without help from the server, the client can't figure out if a request was dispatched or not: it can't figure out if the failure is because the request never reached the server or if it's because the reply was lost on its way back to the client.

  • Thank you Benoit and Matthew! This is what I needed to know.