com.crankuptheamps.client
Interface BookmarkStore

All Known Implementing Classes:
DefaultBookmarkStore, LoggedBookmarkStore, MemoryBookmarkStore, RingBookmarkStore

public interface BookmarkStore


Method Summary
 void discard(Field subId, long bookmarkSeqNo)
          Log a discard-bookmark entry to the persistent log based on a bookmark sequence number.
 void discard(Message message)
          Log a discard-bookmark entry to the persistent log based on a Message.
 Field getMostRecent(Field subID)
          Returns the most recent bookmark from the log that ought to be used for (re-)subscriptions.
 long getOldestBookmarkSeq(Field subId)
          Called to retrieve the sequence number of the oldest bookmark in the store.
 boolean isDiscarded(Message message)
          Called for each arriving message to determine if the application has already seen this bookmark and should not be reprocessed.
 long log(Message message)
          Log a bookmark to the persistent log.
 void noPersistedAcks(Field subId)
          Called internally to let the bookmark store know that the AMPS server version doesn't support persisted acks for bookmarks.
 void persisted(Field subId, BookmarkField bookmark)
          Called to mark a message as safely persisted by AMPS to all of its sync replication destination.
 void persisted(Field subId, long bookmarkSeqNo)
          Called to mark a message as safely persisted by AMPS to all of its sync replication destination.
 void purge()
          Called to purge the contents of this store.
 void setResizeHandler(BookmarkStoreResizeHandler handler)
          Called to set a resize handler that is invoked when the store needs to resize.
 void setServerVersion(int version_)
          Called by the Client when connected to an AMPS server to indicate what version the server is.
 

Method Detail

log

long log(Message message)
         throws AMPSException
Log a bookmark to the persistent log.

Returns:
the corresponding bookmark sequence number for this bookmark
Throws:
AMPSException

discard

void discard(Field subId,
             long bookmarkSeqNo)
             throws AMPSException
Log a discard-bookmark entry to the persistent log based on a bookmark sequence number. Recommended to use discard(Message) instead for performance.

Throws:
AMPSException

discard

void discard(Message message)
             throws AMPSException
Log a discard-bookmark entry to the persistent log based on a Message.

Throws:
AMPSException

getMostRecent

Field getMostRecent(Field subID)
                    throws AMPSException
Returns the most recent bookmark from the log that ought to be used for (re-)subscriptions.

Throws:
AMPSException

isDiscarded

boolean isDiscarded(Message message)
                    throws AMPSException
Called for each arriving message to determine if the application has already seen this bookmark and should not be reprocessed. Returns 'true' if the bookmark is in the log and should not be re-processed, false otherwise.

Throws:
AMPSException

purge

void purge()
           throws AMPSException
Called to purge the contents of this store. Removes any tracking history associated with publishers and received messages, and may delete or truncate on-disk representations as well.

Throws:
AMPSException

setResizeHandler

void setResizeHandler(BookmarkStoreResizeHandler handler)
Called to set a resize handler that is invoked when the store needs to resize.


getOldestBookmarkSeq

long getOldestBookmarkSeq(Field subId)
                          throws AMPSException
Called to retrieve the sequence number of the oldest bookmark in the store.

Throws:
AMPSException

persisted

void persisted(Field subId,
               BookmarkField bookmark)
               throws AMPSException
Called to mark a message as safely persisted by AMPS to all of its sync replication destination.

Throws:
AMPSException

persisted

void persisted(Field subId,
               long bookmarkSeqNo)
               throws AMPSException
Called to mark a message as safely persisted by AMPS to all of its sync replication destination.

Throws:
AMPSException

noPersistedAcks

void noPersistedAcks(Field subId)
                     throws AMPSException
Called internally to let the bookmark store know that the AMPS server version doesn't support persisted acks for bookmarks.

Throws:
AMPSException

setServerVersion

void setServerVersion(int version_)
Called by the Client when connected to an AMPS server to indicate what version the server is.