net.sf.xenqtt.message
Interface MessageHandler


public interface MessageHandler

Handles received MqttMessages. There is a method for each message type. This handler will always be called by the IO thread that owns the channel. It is safe to invoke any method on the channel in these methods. Implementations must not block this thread.


Method Summary
 void channelClosed(MqttChannel channel, Throwable cause)
          Called when a MQTT channel is formally closed.
 void channelOpened(MqttChannel channel)
          Called when a MQTT channel is opened.
 void connAck(MqttChannel channel, ConnAckMessage message)
          Called when a ConnAckMessage is received through the specified channel
 void connect(MqttChannel channel, ConnectMessage message)
          Called when a ConnectMessage is received through the specified channel
 void disconnect(MqttChannel channel, DisconnectMessage message)
          Called when a DisconnectMessage is received through the specified channel
 void pubAck(MqttChannel channel, PubAckMessage message)
          Called when a PubAckMessage is received through the specified channel
 void pubComp(MqttChannel channel, PubCompMessage message)
          Called when a PubCompMessage is received through the specified channel
 void publish(MqttChannel channel, PubMessage message)
          Called when a PubMessage is received through the specified channel
 void pubRec(MqttChannel channel, PubRecMessage message)
          Called when a PubRecMessage is received through the specified channel
 void pubRel(MqttChannel channel, PubRelMessage message)
          Called when a PubRelMessage is received through the specified channel
 void subAck(MqttChannel channel, SubAckMessage message)
          Called when a SubAckMessage is received through the specified channel
 void subscribe(MqttChannel channel, SubscribeMessage message)
          Called when a SubscribeMessage is received through the specified channel
 void unsubAck(MqttChannel channel, UnsubAckMessage message)
          Called when a UnsubAckMessage is received through the specified channel
 void unsubscribe(MqttChannel channel, UnsubscribeMessage message)
          Called when a UnsubscribeMessage is received through the specified channel
 

Method Detail

connect

void connect(MqttChannel channel,
             ConnectMessage message)
             throws Exception
Called when a ConnectMessage is received through the specified channel

Throws:
Exception

connAck

void connAck(MqttChannel channel,
             ConnAckMessage message)
             throws Exception
Called when a ConnAckMessage is received through the specified channel

Throws:
Exception

publish

void publish(MqttChannel channel,
             PubMessage message)
             throws Exception
Called when a PubMessage is received through the specified channel

Throws:
Exception

pubAck

void pubAck(MqttChannel channel,
            PubAckMessage message)
            throws Exception
Called when a PubAckMessage is received through the specified channel

Throws:
Exception

pubRec

void pubRec(MqttChannel channel,
            PubRecMessage message)
            throws Exception
Called when a PubRecMessage is received through the specified channel

Throws:
Exception

pubRel

void pubRel(MqttChannel channel,
            PubRelMessage message)
            throws Exception
Called when a PubRelMessage is received through the specified channel

Throws:
Exception

pubComp

void pubComp(MqttChannel channel,
             PubCompMessage message)
             throws Exception
Called when a PubCompMessage is received through the specified channel

Throws:
Exception

subscribe

void subscribe(MqttChannel channel,
               SubscribeMessage message)
               throws Exception
Called when a SubscribeMessage is received through the specified channel

Throws:
Exception

subAck

void subAck(MqttChannel channel,
            SubAckMessage message)
            throws Exception
Called when a SubAckMessage is received through the specified channel

Throws:
Exception

unsubscribe

void unsubscribe(MqttChannel channel,
                 UnsubscribeMessage message)
                 throws Exception
Called when a UnsubscribeMessage is received through the specified channel

Throws:
Exception

unsubAck

void unsubAck(MqttChannel channel,
              UnsubAckMessage message)
              throws Exception
Called when a UnsubAckMessage is received through the specified channel

Throws:
Exception

disconnect

void disconnect(MqttChannel channel,
                DisconnectMessage message)
                throws Exception
Called when a DisconnectMessage is received through the specified channel

Throws:
Exception

channelOpened

void channelOpened(MqttChannel channel)
Called when a MQTT channel is opened. Opened is when the connection to the broker or from the client has been established but before any messages have been sent.

Parameters:
channel - The channel that was opened.

channelClosed

void channelClosed(MqttChannel channel,
                   Throwable cause)
Called when a MQTT channel is formally closed.

Parameters:
channel - The channel that was closed
cause - The reason the channel was closed. Null if the channel was not closed because of an exception.


Copyright © 2013. All Rights Reserved.