public interface Subscription
BookmarkStore
. If you feel that your requirements warrant
creating a customized bookmark store implementation, please contact
AMPS support for further advice.
public static void main(String[] args) {
try (HAClient client = new HAClient("subscribeExample");) {
DefaultServerChooser sc = new DefaultServerChooser();
sc.add(uri_);
client.setServerChooser(sc);
RingBookmarkStore bs = new RingBookmarkStore("bookmarks");
client.setBookmarkStore(bs);
client.connectAndLogon();
// create the object to process the messages.
BookmarkMessageHandler bmh = new BookmarkMessageHandler(client);
System.out.println("... entering subscription ...");
// Enter the subscription. This statement requests all
// messages that have not been previously processed on the
// "messages-history" topic.
client.executeAsync( new Command(Message.Command.Subscribe)
.setTopic("messages-history")
.setSubId(new CommandId("sample-replay-id"))
.setBookmark(Client.Bookmarks.MOST_RECENT),
bmh);
while (true)
{
Thread.sleep(100);
}
}
catch (AMPSException e) {
System.err.println(e.getLocalizedMessage());
e.printStackTrace(System.err);
}
Modifier and Type | Method and Description |
---|---|
void |
discard(long index) |
Field |
getMostRecent() |
Field |
getMostRecentList(boolean useList) |
long |
getOldestBookmarkSeq() |
BookmarkRangeField |
getRange() |
boolean |
isDiscarded(BookmarkField bookmark) |
long |
log(BookmarkField bookmark) |
void |
setLastPersisted(BookmarkField bookmark) |
void |
setLastPersisted(long bookmark)
Deprecated.
|
void |
setResizeHandler(BookmarkStoreResizeHandler handler,
BookmarkStore store) |
long log(BookmarkField bookmark) throws java.io.IOException, CommandException
java.io.IOException
CommandException
void discard(long index) throws java.io.IOException
java.io.IOException
boolean isDiscarded(BookmarkField bookmark) throws java.io.IOException
java.io.IOException
Field getMostRecent()
Field getMostRecentList(boolean useList)
BookmarkRangeField getRange()
@Deprecated void setLastPersisted(long bookmark) throws java.io.IOException
java.io.IOException
void setLastPersisted(BookmarkField bookmark) throws java.io.IOException
java.io.IOException
long getOldestBookmarkSeq()
void setResizeHandler(BookmarkStoreResizeHandler handler, BookmarkStore store)