public class MqttClientView extends org.eclipse.ui.part.ViewPart implements MqttCallback
| Constructor and Description |
|---|
MqttClientView()
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
connectionLost(Throwable cause)
Logs a message that the broker connection has been lost and attempts to reconnect.
|
void |
createPartControl(org.eclipse.swt.widgets.Composite parent)
Create the control
|
void |
deliveryComplete(IMqttDeliveryToken token)
Called when delivery for a message has been completed, and all
acknowledgments have been received.
|
void |
deliveryComplete(MqttDeliveryToken token)
Logs that a publish has completed (an acknowledgement has been received from the broker
|
static byte[] |
getBytesFromFile(File file)
Return the bytes from a file
|
static String |
getHexString(byte[] b)
Returns a hex string representation of the byte array
|
void |
messageArrived(String topic,
MqttMessage message)
This method is called when a message arrives from the server.
|
void |
setFocus()
Sets the focus
|
void |
valueChanged(org.eclipse.swt.widgets.Text text)
A parameter's value has changed, update info
|
checkSite, getViewSite, init, init, saveState, setContentDescription, setInitializationData, setPartNameaddPartPropertyListener, addPropertyListener, dispose, firePartPropertyChanged, firePropertyChange, getAdapter, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, getTitleToolTip, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusyaddListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObjectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic void setFocus()
setFocus in interface org.eclipse.ui.IWorkbenchPartsetFocus in class org.eclipse.ui.part.WorkbenchPartpublic void createPartControl(org.eclipse.swt.widgets.Composite parent)
createPartControl in interface org.eclipse.ui.IWorkbenchPartcreatePartControl in class org.eclipse.ui.part.WorkbenchPartpublic void valueChanged(org.eclipse.swt.widgets.Text text)
public void connectionLost(Throwable cause)
connectionLost in interface MqttCallbackcause - the reason behind the loss of connection.public void messageArrived(String topic, MqttMessage message) throws Exception
MqttCallbackThis method is invoked synchronously by the MQTT client. An acknowledgment is not sent back to the server until this method returns cleanly.
If an implementation of this method throws an Exception, then the
client will be shut down. When the client is next re-connected, any QoS
1 or 2 messages will be redelivered by the server.
Any additional messages which arrive while an implementation of this method is running, will build up in memory, and will then back up on the network.
If an application needs to persist data, then it should ensure the data is persisted prior to returning from this method, as after returning from this method, the message is considered to have been delivered, and will not be reproducible.
It is possible to send a new message within an implementation of this callback (for example, a response to this message), but the implementation must not disconnect the client, as it will be impossible to send an acknowledgment for the message being processed, and a deadlock will occur.
messageArrived in interface MqttCallbacktopic - name of the topic on the message was published tomessage - the actual message.Exception - if a terminal error has occurred, and the client should be
shut down.public void deliveryComplete(MqttDeliveryToken token)
public static String getHexString(byte[] b)
public static byte[] getBytesFromFile(File file) throws IOException
IOExceptionpublic void deliveryComplete(IMqttDeliveryToken token)
MqttCallbackdeliveryComplete in interface MqttCallbacktoken - the delivery token associated with the message.Copyright © 2025 Eclipse Paho. All rights reserved.