AMPS C# Client  5.3.5.0
AMPS C# Client for .NET
AMPS.Client.MemoryBookmarkStore Class Reference

Implements a bookmark store useful for handling server failover scenarios, but without a backing store to recover from subscriber failure. More...

+ Inheritance diagram for AMPS.Client.MemoryBookmarkStore:

Public Member Functions

 MemoryBookmarkStore ()
 Initializes a new instance of the MemoryBookmarkStore class with default settings. More...
 
 MemoryBookmarkStore (RecoveryPointAdapter adapter_, RecoveryPointFactory factory_=null)
 Initializes a new instance of the MemoryBookmarkStore class with the specified adapter and factory. More...
 
 MemoryBookmarkStore (int targetNumberOfSubscriptions)
 Initialize self with a target number of subscriptions to store. More...
 
void setRecoveryPointFactory (RecoveryPointFactory factory_)
 Change the RecoveryPointFactory used by this store for its adaptor. More...
 
void Dispose ()
 Disposes resources used by the MemoryBookmarkStore. More...
 
long log (Message message)
 This is a method the Client calls and is not for customer user. Logs a message's bookmark to the bookmark store and updates the message's bookmark sequence number. More...
 
void discard (Field subId, long bookmarkSeqNo)
 Discards a bookmark entry associated with a specific subscription and bookmark sequence number. More...
 
void discard (Message message)
 Discards a bookmark entry based on the information provided in the message. More...
 
Field getMostRecent (Field subId, bool useList=true)
 Retrieves the most recent bookmark associated with a subscription identified by the given subId. More...
 
bool isDiscarded (Message message)
 This method is called internally by the client to determine whether a message's bookmark received from the amps server has already been discarded OR already been delivered to the subscriber during this run. More...
 
void persisted (Field subId, long bookmark)
 Old style of setting a persisted bookmark no longer used. More...
 
void persisted (Field subId, BookmarkField bookmark)
 This method is called by the client and it is used to process persisted acknowledgements that track a safe recovery point in the txlog. Sets a persisted bookmark for a subscription. More...
 
void purge (Field subId_)
 Removes all entries in the bookmark store associated with a specific subscription ID(subId_). This method is used to clear messages received and discarded for a particular subscription. This should not be called if the store is still attached to a connected Client where this subId is still active. More...
 
void purge ()
 Purges the entire bookmark store, removing all entries. This method removes all information about any subscriptions. This should not be called if the store is still attached to a connected Client with any active subscriptions. More...
 
long getOldestBookmarkSeq (Field subId)
 Retrieves the oldest active bookmark sequence number that is not discarded for the given subscription. More...
 
void setResizeHandler (BookmarkStoreResizeHandler handler)
 Sets a handler for bookmark store resize events. More...
 
void setServerVersion (int version)
 Used internally to change the version of the AMPS server that this bookmark store's client has connected to. More...
 
int getServerVersion ()
 Return the server version that was set by the Client. More...
 

Detailed Description

Implements a bookmark store useful for handling server failover scenarios, but without a backing store to recover from subscriber failure.

An optional RecoveryPointAdapter can be specified at construction to persist bookmark subscription recovery state to an external store so the subscription can be resumed if the subscriber fails.

Constructor & Destructor Documentation

◆ MemoryBookmarkStore() [1/3]

AMPS.Client.MemoryBookmarkStore.MemoryBookmarkStore ( )
inline

Initializes a new instance of the MemoryBookmarkStore class with default settings.

◆ MemoryBookmarkStore() [2/3]

AMPS.Client.MemoryBookmarkStore.MemoryBookmarkStore ( RecoveryPointAdapter  adapter_,
RecoveryPointFactory  factory_ = null 
)
inline

Initializes a new instance of the MemoryBookmarkStore class with the specified adapter and factory.

Parameters
adapter_The recovery point adapter.
factory_The recovery point factory.

◆ MemoryBookmarkStore() [3/3]

AMPS.Client.MemoryBookmarkStore.MemoryBookmarkStore ( int  targetNumberOfSubscriptions)
inline

Initialize self with a target number of subscriptions to store.

Parameters
targetNumberOfSubscriptionsThe number of subscriptions this store will need to track.

Member Function Documentation

◆ discard() [1/2]

void AMPS.Client.MemoryBookmarkStore.discard ( Field  subId,
long  bookmarkSeqNo 
)
inline

Discards a bookmark entry associated with a specific subscription and bookmark sequence number.

Parameters
subIdThe identifier of the subscription.
bookmarkSeqNoThe sequence number of the bookmark entry to discard.
Exceptions
AMPSExceptionIf an error occurs while discarding from the bookmark store.

Implements AMPS.Client.BookmarkStore.

◆ discard() [2/2]

void AMPS.Client.MemoryBookmarkStore.discard ( Message  message)
inline

Discards a bookmark entry based on the information provided in the message.

Parameters
messageThe message containing information about the bookmark to discard.
Exceptions
AMPSExceptionIf an error occurs while discarding from the bookmark store.

Implements AMPS.Client.BookmarkStore.

◆ Dispose()

void AMPS.Client.MemoryBookmarkStore.Dispose ( )
inline

Disposes resources used by the MemoryBookmarkStore.

◆ getMostRecent()

Field AMPS.Client.MemoryBookmarkStore.getMostRecent ( Field  subId,
bool  useList = true 
)
inline

Retrieves the most recent bookmark associated with a subscription identified by the given subId.

Parameters
subIdThe identifier of the subscription for which to retrieve the most recent bookmark.
useListA flag indicating whether to retrieve the most recent bookmark as a list or just the single bookmark that was last discarded. A list is the only way to guarantee successful failover and no missed message.
Returns
The most recent bookmark for the specified subscription.
Exceptions
AMPSExceptionIf an error occurs while retrieving the most recent bookmark or if the store is not open.

Implements AMPS.Client.BookmarkStore.

◆ getOldestBookmarkSeq()

long AMPS.Client.MemoryBookmarkStore.getOldestBookmarkSeq ( Field  subId)
inline

Retrieves the oldest active bookmark sequence number that is not discarded for the given subscription.

Parameters
subIdThe identifier of the subscription for which to retrieve the oldest bookmark sequence number.
Returns
The oldest bookmark sequence number for the specified subscription.
Exceptions
AMPSExceptionIf an error occurs while retrieving the oldest bookmark sequence number or if the store is not open.

Implements AMPS.Client.BookmarkStore.

◆ getServerVersion()

int AMPS.Client.MemoryBookmarkStore.getServerVersion ( )
inline

Return the server version that was set by the Client.

Returns
The server version, represented as an integer

◆ isDiscarded()

bool AMPS.Client.MemoryBookmarkStore.isDiscarded ( Message  message)
inline

This method is called internally by the client to determine whether a message's bookmark received from the amps server has already been discarded OR already been delivered to the subscriber during this run.

Parameters
messageThe message containing the bookmark to check for discarding.
Returns
True if the bookmark has been discarded; false otherwise.
Exceptions
AMPSExceptionIf an error occurs while checking if the bookmark is discarded or if the store is not open.

Implements AMPS.Client.BookmarkStore.

◆ log()

long AMPS.Client.MemoryBookmarkStore.log ( Message  message)
inline

This is a method the Client calls and is not for customer user. Logs a message's bookmark to the bookmark store and updates the message's bookmark sequence number.

Parameters
messageThe message to log, containing the bookmark to be stored.
Returns
The index at which the bookmark is stored in the subscription.
Exceptions
Exceptions.AMPSExceptionIf an error occurs while logging to the bookmark store.

Implements AMPS.Client.BookmarkStore.

◆ persisted() [1/2]

void AMPS.Client.MemoryBookmarkStore.persisted ( Field  subId,
BookmarkField  bookmark 
)
inline

This method is called by the client and it is used to process persisted acknowledgements that track a safe recovery point in the txlog. Sets a persisted bookmark for a subscription.

Parameters
subIdThe identifier of the subscription for which to set the persisted bookmark.
bookmarkThe persisted bookmark value to set.
Exceptions
AMPSExceptionIf an error occurs while setting the persisted bookmark or if the store is not open.

Implements AMPS.Client.BookmarkStore.

◆ persisted() [2/2]

void AMPS.Client.MemoryBookmarkStore.persisted ( Field  subId,
long  bookmark 
)
inline

Old style of setting a persisted bookmark no longer used.

Parameters
subIdThe subId associated with the bookmark to be persisted.
bookmarkThe bookmark to be persisted.

Implements AMPS.Client.BookmarkStore.

◆ purge() [1/2]

void AMPS.Client.MemoryBookmarkStore.purge ( )
inline

Purges the entire bookmark store, removing all entries. This method removes all information about any subscriptions. This should not be called if the store is still attached to a connected Client with any active subscriptions.

Implements AMPS.Client.BookmarkStore.

◆ purge() [2/2]

void AMPS.Client.MemoryBookmarkStore.purge ( Field  subId_)
inline

Removes all entries in the bookmark store associated with a specific subscription ID(subId_). This method is used to clear messages received and discarded for a particular subscription. This should not be called if the store is still attached to a connected Client where this subId is still active.

Parameters
subId_The subscription ID for which to remove entries from the store.

Implements AMPS.Client.BookmarkStore.

◆ setRecoveryPointFactory()

void AMPS.Client.MemoryBookmarkStore.setRecoveryPointFactory ( RecoveryPointFactory  factory_)
inline

Change the RecoveryPointFactory used by this store for its adaptor.

Parameters
factory_The new RecoveryPointFactory

◆ setResizeHandler()

void AMPS.Client.MemoryBookmarkStore.setResizeHandler ( BookmarkStoreResizeHandler  handler)
inline

Sets a handler for bookmark store resize events.

Parameters
handlerThe BookmarkStoreResizeHandler to set.

Implements AMPS.Client.BookmarkStore.

◆ setServerVersion()

void AMPS.Client.MemoryBookmarkStore.setServerVersion ( int  version)
inline

Used internally to change the version of the AMPS server that this bookmark store's client has connected to.

Parameters
versionAn AMPS server version integer of the form 05030400 for version 5.3.4.0.

Implements AMPS.Client.BookmarkStore.


The documentation for this class was generated from the following file: