Package io.moquette.broker
Class NettyUtils
- java.lang.Object
-
- io.moquette.broker.NettyUtils
-
public final class NettyUtils extends Object
Some Netty's channels utilities.
-
-
Field Summary
Fields Modifier and Type Field Description static StringATTR_USERNAME
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancleanSession(io.netty.channel.Channel channel)static voidcleanSession(io.netty.channel.Channel channel, boolean cleanSession)static StringclientID(io.netty.channel.Channel channel)static voidclientID(io.netty.channel.Channel channel, String clientID)static ObjectgetAttribute(io.netty.channel.ChannelHandlerContext ctx, io.netty.util.AttributeKey<Object> key)static voidkeepAlive(io.netty.channel.Channel channel, int keepAlive)static StringuserName(io.netty.channel.Channel channel)static voiduserName(io.netty.channel.Channel channel, String username)static io.netty.handler.codec.mqtt.MqttMessagevalidateMessage(Object message)Validate that the provided message is an MqttMessage and that it does not contain a failed result.
-
-
-
Field Detail
-
ATTR_USERNAME
public static final String ATTR_USERNAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAttribute
public static Object getAttribute(io.netty.channel.ChannelHandlerContext ctx, io.netty.util.AttributeKey<Object> key)
-
keepAlive
public static void keepAlive(io.netty.channel.Channel channel, int keepAlive)
-
cleanSession
public static void cleanSession(io.netty.channel.Channel channel, boolean cleanSession)
-
cleanSession
public static boolean cleanSession(io.netty.channel.Channel channel)
-
clientID
public static void clientID(io.netty.channel.Channel channel, String clientID)
-
clientID
public static String clientID(io.netty.channel.Channel channel)
-
userName
public static void userName(io.netty.channel.Channel channel, String username)
-
userName
public static String userName(io.netty.channel.Channel channel)
-
validateMessage
public static io.netty.handler.codec.mqtt.MqttMessage validateMessage(Object message) throws IOException, ClassCastException
Validate that the provided message is an MqttMessage and that it does not contain a failed result.- Parameters:
message- to be validated- Returns:
- the casted provided message
- Throws:
IOException- in case of an fail message this will wrap the root causeClassCastException- if the provided message is no MqttMessage
-
-