Skip to main content

subscribe-bookmark-filter

Including the basic AMPS library:

import com.crankuptheamps.client.*;
import com.crankuptheamps.client.exception.*;

Constructing the command:

Command cmd = new Command(Message.Command.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 the filter to use for the subscription
.setFilter(filter)
;

The command can now be used in execute or executeAsync.