subscribe-bookmark-rate-gap
Including the basic AMPS library:
#include <amps/ampsplusplus.hpp>
Constructing the command:
AMPS::Command cmd(AMPS::Message::Command::Subscribe);
cmd.setTopic(topic);
// Set consistent subId for recovery purposes.
cmd.setSubId(subId);
// Start from the recovery point in the bookmark store
cmd.setBookmark(AMPS::Client::MOST_RECENT());
// Set options for replay: in this case, deliver messages
// 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.
AMPS::Message::Options opts;
opts.setRate("1x");
opts.setRateMaxGap("1s");
cmd.setOptions(opts);
The command can now be used in execute or executeAsync.