Skip to main content

subscribe-bookmark-pause

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);

// Pause on a specific bookmark: all subscriptions to be
// resumed together should be entered paused at the same bookmark.
cmd.setBookmark(pause_bookmark);

AMPS::Options opts;
opts.setPause();
cmd.setOptions(opts);

The command can now be used in execute or executeAsync.