Skip to main content

subscribe-bookmark-rate

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, maximum of 10,000
// messages/sec for this subscription

AMPS::Message::Options opts;
opts.setRate("10000");
cmd.setOptions(opts);

The command can now be used in execute or executeAsync.