Why does publishFlush() wait forever when I'm using replication?

When this happens, the most common reason is that a replication destination configured for sync acknowledgements is offline.

The publishFlush() methods are intended to ensure that all messages have been published to AMPS and acknowledged by AMPS as persisted. To acknowledge a message as persisted, all replications using sync acknowledgements must acknowledge the message.

This means that if one of those destinations is offline, AMPS is unable to acknowledge the message as persisted, since that destination has not acknowledged the message. This means that the client will continue waiting for the acknowledgement.

There are several options for handling this situation:

  • Bring the destination back online. While this may seem obvious, often the best solution is to restore the offline instance so the messages can be replicated.

  • Use the overload of publishFlush() that takes a timeout. After the timeout, your application can retry or recover as needed.

  • Configure an action to automatically downgrade destinations that go offline or fall behind, and upgrade the instances when replication to them catches up. This approach is described in the AMPS User Guide.

  • Use the administrative console to manually downgrade the destination that is offline.

Last updated