Interface Mqtt5ClientOptions.PublishEvents

  • Enclosing class:
    Mqtt5ClientOptions

    public static interface Mqtt5ClientOptions.PublishEvents
    An interface that defines all of the publish functions the Mqtt5Client will call when it receives a publish packet.
    • Method Detail

      • onMessageReceived

        void onMessageReceived​(Mqtt5Client client,
                               PublishReturn publishReturn)
        Called when an MQTT PUBLISH packet is received by the client.

        To take manual control of the publish acknowledgement for a QoS 1 message, call PublishReturn.acquirePublishAcknowledgementControl() within this callback. If you do so, the client will NOT automatically send the publish acknowledgement. You are responsible for calling Mqtt5Client.invokePublishAcknowledgement(Mqtt5PublishAcknowledgementControlHandle) later.

        If you do not call acquirePublishAcknowledgementControl() within the callback , the client will automatically send the publish acknowledgement after this callback returns.

        Parameters:
        client - The client that has received the message
        publishReturn - All of the data that was received from the server