public interface MqttPersistable
MqttClientPersistence
interface.
When data is passed across the interface the header and payload are separated, so that unnecessary message copies may be avoided. For example, if a 10 MB payload was published it would be inefficient to create a byte array a few bytes larger than 10 MB and copy the MQTT message header and payload into a contiguous byte array.
When the request to persist data is made a separate byte array and offset is passed for the header and payload. Only the data between offset and length need be persisted. So for example, a message to be persisted consists of a header byte array starting at offset 1 and length 4, plus a payload byte array starting at offset 30 and length 40000. There are three ways in which the persistence implementation may return data to the client on recovery:
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getHeaderBytes()
Returns the header bytes in an array.
|
int |
getHeaderLength()
Returns the length of the header.
|
int |
getHeaderOffset()
Returns the offset of the header within the byte array returned by
getHeaderBytes(). |
byte[] |
getPayloadBytes()
Returns the payload bytes in an array.
|
int |
getPayloadLength()
Returns the length of the payload.
|
int |
getPayloadOffset()
Returns the offset of the payload within the byte array returned by
getPayloadBytes(). |
byte[] getHeaderBytes()
throws MqttPersistenceException
getHeaderOffset()
and continue for getHeaderLength().MqttPersistenceExceptionint getHeaderLength()
throws MqttPersistenceException
MqttPersistenceExceptionint getHeaderOffset()
throws MqttPersistenceException
getHeaderBytes().MqttPersistenceExceptionbyte[] getPayloadBytes()
throws MqttPersistenceException
getPayloadOffset()
and continue for getPayloadLength().MqttPersistenceExceptionint getPayloadLength()
throws MqttPersistenceException
MqttPersistenceExceptionint getPayloadOffset()
throws MqttPersistenceException
getPayloadBytes().MqttPersistenceExceptionCopyright © 2017 Eclipse Paho. All Rights Reserved.