In bookmark subscribes, why does EPOCH give me the same messages as MOST_RECENT?

The AMPS HA clients have built in duplicate detection: when you're using a bookmark store, the clients don't deliver messages that the application has already processed.

This can cause a situation where EPOCH subscriptions and MOST_RECENT subscriptions deliver the same messages to your message handler. The situation happens more frequently in development and testing than production, and it's a good thing to be aware of. This happens when the application has processed messages and then replays messages from the start of the transaction log.

Here's what happens:

  • The program requests messages starting at EPOCH (the beginning of the transaction log)

  • AMPS enters the subscription, and begins sending messages

  • The client checks each message to see if it has been received before. If it has been, the client treats the message as a duplicate.

  • As a result, the program does not see messages arriving on the subscription until the replay gets to messages that haven't yet been processed -- behavior that looks the same as MOST_RECENT.

To verify this, you can add a duplicate message handler to your program. The client will provide duplicate messages to that handler.

To reset the records that the bookmark store keeps regarding what messages have been processed, you can call purge on the bookmark store. This clears the store, and any message received will be treated as a new message.

Last updated