subscribe-bookmark-rate-gap
Importing the AMPS client library:
using AMPS.Client;
using AMPS.Client.Exceptions;
Constructing the command:
Command cmd = new Command(Message.Commands.Subscribe)
.setTopic(topic)
// consistent ID for recovery purposes
.setSubId(subId)
// Recover from the bookmark store's
// replay point, or the beginning of the
// txlog if there is no existing recovery point
.setBookmark(Client.Bookmarks.MOST_RECENT)
// Set options for replay: in this case, deliver
// at the original rate, *except* if there is a gap
// of more than 1s in the original publish stream.
// If that happens, deliver the next message
// after a maximum of 1s.
.setOptions(Message.Options.Rate("1x")
+ Message.Options.RateMaxGap("1s"))
;
The command can now be used in execute or executeAsync.