public interface BookmarkStore
extends java.lang.AutoCloseable
Client
to provide
resumable subscriptions and client-side duplicate message handling.Modifier and Type | Method and Description |
---|---|
void |
discard(Field subId,
long bookmarkSeqNo)
Call this when you want to mark the message specified by the
subscription ID and the bookmark sequence number as discarded,
indicating that the application has completed processing the message.
|
void |
discard(Message message)
Call this when you want to mark the provided message as discarded,
indicating that the application has completed processing the message.
|
Field |
getMostRecent(Field subID)
Call this when you want to return the correct recovery point for
resubscription of the provided subID from the BookmarkStore.
|
Field |
getMostRecent(Field subID,
boolean useList)
Call this when you want to return the correct recovery point for
resubscription of the provided subID from the BookmarkStore.
|
long |
getOldestBookmarkSeq(Field subId)
Call this when you want 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 processed and discarded this message.
|
long |
log(Message message)
Called internally by the Client to log a bookmark to the persistent log.
|
void |
persisted(Field subId,
BookmarkField bookmark)
Called internally by the Client to record the last persisted message in the transaction log of the connected AMPS server
to all of its sync replication destinations.
|
void |
persisted(Field subId,
long bookmarkSeqNo)
Deprecated.
use
persisted(Field, BookmarkField) instead. |
void |
purge()
Call this when you want to purge the contents of this store.
|
void |
purge(Field subId)
Call this when you want to purge the contents of this store for a given subscription ID.
|
void |
setResizeHandler(BookmarkStoreResizeHandler handler)
Called this when you want to set a resize handler that is invoked when the store needs to resize.
|
void |
setServerVersion(int version_)
Called internally by the Client when connected to an AMPS server to indicate
what version the server is.
|
long log(Message message) throws AMPSException
message
- The message containing the bookmark to log.AMPSException
- Thrown when the message cannot be logged.void discard(Field subId, long bookmarkSeqNo) throws AMPSException
subId
- The subscription ID of the bookmark.bookmarkSeqNo
- The bookmark sequence number.AMPSException
- Thrown when the specified bookmark cannot be discareded.void discard(Message message) throws AMPSException
message
- Message to be marked as discarded.AMPSException
- Thrown when the specified message cannot be discareded.Field getMostRecent(Field subID) throws AMPSException
subID
- The subscription ID of the most recent bookmark.AMPSException
- Thrown when the store cannot produce a recovery point for the specified subID.Field getMostRecent(Field subID, boolean useList) throws AMPSException
subID
- The subscription ID of the most recent bookmark.useList
- In the case where the store has not received any persisted
acks, it will build a list of bookmarks based on the last discarded for
each publisher if true (default).AMPSException
- Thrown when the store cannot produce a recovery point for the specified subID.boolean isDiscarded(Message message) throws AMPSException
message
- Message used to determine if the application has already
processed and discarded the message.AMPSException
- Thrown when the store cannot determine if the message is discarded.void purge() throws AMPSException
AMPSException
- Thrown if the store is unable to remove the contents.void purge(Field subId) throws AMPSException
subId
- The identifier of the subscription to purge.AMPSException
- Thrown if the store is unable to remove information for the subscription.void setResizeHandler(BookmarkStoreResizeHandler handler)
handler
- The handler to invoke for the resize.long getOldestBookmarkSeq(Field subId) throws AMPSException
subId
- The subscription ID for the oldest bookmark in the store.AMPSException
- The operation could not successfully be completed.void persisted(Field subId, BookmarkField bookmark) throws AMPSException
subId
- The subscription ID for the message.bookmark
- The bookmark containing the message.AMPSException
- Thrown if the store is unable to record information in the store.@Deprecated void persisted(Field subId, long bookmarkSeqNo) throws AMPSException
persisted(Field, BookmarkField)
instead.subId
- The subscription ID for the message.bookmarkSeqNo
- The bookmark sequence number.AMPSException
- Thrown if the store is unable to record information in the store.void setServerVersion(int version_)
version_
- The version of the AMPS server.