-
- All Implemented Interfaces:
-
java.lang.Runnable
public class DisconnectedMessageBuffer implements Runnable
-
-
Field Summary
Fields Modifier and Type Field Description private IDiscardedBufferMessageCallbackmessageDiscardedCallBack
-
Constructor Summary
Constructors Constructor Description DisconnectedMessageBuffer(DisconnectedBufferOptions options)
-
Method Summary
Modifier and Type Method Description voidsetMessageDiscardedCallBack(IDiscardedBufferMessageCallback callback)voidputMessage(MqttWireMessage message, MqttToken token)This will add a new message to the offline buffer, if the buffer is full and deleteOldestMessages is enabled then the 0th item in the buffer will be deleted and the new message will be added. BufferedMessagegetMessage(int messageIndex)Retrieves a message from the buffer at the given index. voiddeleteMessage(int messageIndex)Removes a message from the buffer intgetMessageCount()Returns the number of messages currently in the buffer voidclear()voidrun()Flushes the buffer of messages into an open connection voidsetPublishCallback(IDisconnectedBufferCallback callback)booleanisPersistBuffer()-
-
Constructor Detail
-
DisconnectedMessageBuffer
DisconnectedMessageBuffer(DisconnectedBufferOptions options)
-
-
Method Detail
-
setMessageDiscardedCallBack
void setMessageDiscardedCallBack(IDiscardedBufferMessageCallback callback)
-
putMessage
void putMessage(MqttWireMessage message, MqttToken token)
This will add a new message to the offline buffer, if the buffer is full and deleteOldestMessages is enabled then the 0th item in the buffer will be deleted and the new message will be added. If it is not enabled then an MqttException will be thrown.
- Parameters:
message- the MqttWireMessage that will be bufferedtoken- the associated MqttToken
-
getMessage
BufferedMessage getMessage(int messageIndex)
Retrieves a message from the buffer at the given index.
- Parameters:
messageIndex- the index of the message to be retrieved in the buffer
-
deleteMessage
void deleteMessage(int messageIndex)
Removes a message from the buffer
- Parameters:
messageIndex- the index of the message to be deleted in the buffer
-
getMessageCount
int getMessageCount()
Returns the number of messages currently in the buffer
-
clear
void clear()
-
run
void run()
Flushes the buffer of messages into an open connection
-
setPublishCallback
void setPublishCallback(IDisconnectedBufferCallback callback)
-
isPersistBuffer
boolean isPersistBuffer()
-
-
-
-