|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Represents a persistent data store, used to store outbound and inbound messages while they
are in flight, enabling delivery to the QOS specified. You can specify an implementation
of this interface using MqttClient.MqttClient(String, String, MqttClientPersistence)
,
which the MqttClient
will use to persist QoS 1 and 2 messages.
If the methods defined throw the MqttPersistenceException then the state of the data persisted
should remain as prior to the method being called. For example, if put(String, MqttPersistable)
throws an exception at any point then the data will be assumed to not be in the persistent store.
Similarly if remove(String)
throws an exception then the data will be
assumed to still be held in the persistent store.
It is up to the persistence interface to log any exceptions or error information which may be required when diagnosing a persistence failure.
Method Summary | |
---|---|
void |
clear()
Clears persistence, so that it no longer contains any persisted data. |
void |
close()
Close the persistent store that was previously opened. |
boolean |
containsKey(java.lang.String key)
Returns whether or not data is persisted using the specified key. |
MqttPersistable |
get(java.lang.String key)
Gets the specified data out of the persistent store. |
java.util.Enumeration |
keys()
Returns an Enumeration over the keys in this persistent data store. |
void |
open(java.lang.String clientId,
java.lang.String serverURI)
Initialise the persistent store. |
void |
put(java.lang.String key,
MqttPersistable persistable)
Puts the specified data into the persistent store. |
void |
remove(java.lang.String key)
Remove the data for the specified key. |
Method Detail |
public void open(java.lang.String clientId, java.lang.String serverURI) throws MqttPersistenceException
clientId
- The client for which the persistent store should be opened.serverURI
- The connection string as specified when the MQTT client instance was created.
MqttPersistenceException
- if there was a problem opening the persistent store.public void close() throws MqttPersistenceException
MqttPersistenceException
public void put(java.lang.String key, MqttPersistable persistable) throws MqttPersistenceException
key
- the key for the data, which will be used later to retrieve it.persistable
- the data to persist
MqttPersistenceException
- if there was a problem putting the data
into the persistent store.public MqttPersistable get(java.lang.String key) throws MqttPersistenceException
key
- the key for the data, which was used when originally saving it.
MqttPersistenceException
- if there was a problem getting the data
from the persistent store.public void remove(java.lang.String key) throws MqttPersistenceException
MqttPersistenceException
public java.util.Enumeration keys() throws MqttPersistenceException
String
objects.
MqttPersistenceException
public void clear() throws MqttPersistenceException
MqttPersistenceException
public boolean containsKey(java.lang.String key) throws MqttPersistenceException
key
- the key for data, which was used when originally saving it.
MqttPersistenceException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |