com.ibm.wiotp.sdk.codecs

Interface MessageCodec<T>

    • Method Detail

      • encode

        byte[] encode(T data,
                      org.joda.time.DateTime timestamp)
        Convert an Object into a byte array suitable to send via MQTT
        Parameters:
        data - the Object to be encoded
        timestamp - the time that the message was generated
        Returns:
        Byte array ready for MQTT message payload
      • decode

        MessageInterface<T> decode(org.eclipse.paho.client.mqttv3.MqttMessage msg)
                            throws MalformedMessageException
        Convert an MQTT message into an instance of com.ibm.wiotp.sdk.Message
        Parameters:
        msg - the MqttMessage from Paho MQTT client to decode
        Returns:
        Object of class T from the decoded MQTT message
        Throws:
        MalformedMessageException - If unable to decode the message
      • getMessageClass

        Class<T> getMessageClass()
      • getMessageFormat

        String getMessageFormat()

Copyright © 2019. All rights reserved.