Package 

Class CommsCallback

  • All Implemented Interfaces:
    java.lang.Runnable , org.eclipse.paho.client.mqttv3.ICommsCallback

    
    public class CommsCallback
     implements Runnable, ICommsCallback
                        

    Bridge between Receiver and the external API. This class gets called by Receiver, and then converts the comms-centric MQTT message objects into ones understood by the external API.

    • Method Detail

      • start

         void start(String threadName)

        Starts up the Callback thread.

      • stop

         void stop()

        Stops the callback thread. This call will block until stop has completed.

      • run

         void run()
      • connectionLost

         void connectionLost(MqttException cause)

        This method is called when the connection to the server is lost. If there is no cause then it was a clean disconnect. The connectionLost callback will be invoked if registered and run on the thread that requested shutdown e.g. receiver or sender thread. If the request was a user initiated disconnect then the disconnect token will be notified.

        Parameters:
        cause - the reason behind the loss of connection.
      • fireActionEvent

         void fireActionEvent(MqttToken token)

        An action has completed - if a completion listener has been set on the token then invoke it with the outcome of the action.

      • messageArrived

         void messageArrived(MqttPublish sendMessage)

        This method is called when a message arrives on a topic. Messages are only added to the queue for inbound messages if the client is not quiescing.

        Parameters:
        sendMessage - the MQTT SEND message.
      • quiesce

         void quiesce()

        Let the call back thread quiesce. Prevent new inbound messages being added to the process queue and let existing work quiesce. (until the thread is told to shutdown).