• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MqttMessageIdVariableHeader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader的典型用法代码示例。如果您正苦于以下问题:Java MqttMessageIdVariableHeader类的具体用法?Java MqttMessageIdVariableHeader怎么用?Java MqttMessageIdVariableHeader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MqttMessageIdVariableHeader类属于io.netty.handler.codec.mqtt包,在下文中一共展示了MqttMessageIdVariableHeader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: puback

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
public static MqttPubAckMessage puback(int messageId) {
	MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.PUBACK, false, MqttQoS.AT_MOST_ONCE, false,
			2);
	MqttMessageIdVariableHeader variableHeader = MqttMessageIdVariableHeader.from(messageId);

	return new MqttPubAckMessage(fixedHeader, variableHeader);
}
 
开发者ID:anyflow,项目名称:lannister,代码行数:8,代码来源:MqttMessageFactory.java


示例2: pubrec

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
public static MqttMessage pubrec(int messageId) {
	MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.PUBREC, false, MqttQoS.AT_MOST_ONCE, false,
			2);
	MqttMessageIdVariableHeader variableHeader = MqttMessageIdVariableHeader.from(messageId);

	return new MqttMessage(fixedHeader, variableHeader);
}
 
开发者ID:anyflow,项目名称:lannister,代码行数:8,代码来源:MqttMessageFactory.java


示例3: pubrel

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
public static MqttMessage pubrel(int messageId) {
	MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.PUBREL, false, MqttQoS.AT_LEAST_ONCE, false,
			2);
	MqttMessageIdVariableHeader variableHeader = MqttMessageIdVariableHeader.from(messageId);

	return new MqttMessage(fixedHeader, variableHeader);
}
 
开发者ID:anyflow,项目名称:lannister,代码行数:8,代码来源:MqttMessageFactory.java


示例4: pubcomp

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
public static MqttMessage pubcomp(int messageId) {
	MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.PUBCOMP, false, MqttQoS.AT_MOST_ONCE, false,
			2);
	MqttMessageIdVariableHeader variableHeader = MqttMessageIdVariableHeader.from(messageId);

	return new MqttMessage(fixedHeader, variableHeader);
}
 
开发者ID:anyflow,项目名称:lannister,代码行数:8,代码来源:MqttMessageFactory.java


示例5: subscribe

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
public static MqttSubscribeMessage subscribe(int messageId, MqttTopicSubscription... topicSubscriptions) {
	int topicNameSize = 0;
	int topicCount = topicSubscriptions.length;

	for (MqttTopicSubscription item : topicSubscriptions) {
		topicNameSize += item.topicName().getBytes(CharsetUtil.UTF_8).length;
	}

	MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.SUBSCRIBE, false, MqttQoS.AT_LEAST_ONCE,
			false, 2 + topicNameSize + topicCount);
	MqttMessageIdVariableHeader variableHeader = MqttMessageIdVariableHeader.from(messageId);
	MqttSubscribePayload payload = new MqttSubscribePayload(Lists.newArrayList(topicSubscriptions));

	return new MqttSubscribeMessage(fixedHeader, variableHeader, payload);
}
 
开发者ID:anyflow,项目名称:lannister,代码行数:16,代码来源:MqttMessageFactory.java


示例6: suback

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
public static MqttSubAckMessage suback(int messageId, List<Integer> grantedQoSLevels) {
	MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.SUBACK, false, MqttQoS.AT_MOST_ONCE, false,
			2 + grantedQoSLevels.size());
	MqttMessageIdVariableHeader variableHeader = MqttMessageIdVariableHeader.from(messageId);
	MqttSubAckPayload payload = new MqttSubAckPayload(grantedQoSLevels);

	return new MqttSubAckMessage(fixedHeader, variableHeader, payload);
}
 
开发者ID:anyflow,项目名称:lannister,代码行数:9,代码来源:MqttMessageFactory.java


示例7: unsuback

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
public static MqttUnsubAckMessage unsuback(int messageId) {
	MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.UNSUBACK, false, MqttQoS.AT_MOST_ONCE, false,
			2);
	MqttMessageIdVariableHeader variableHeader = MqttMessageIdVariableHeader.from(messageId);

	return new MqttUnsubAckMessage(fixedHeader, variableHeader);
}
 
开发者ID:anyflow,项目名称:lannister,代码行数:8,代码来源:MqttMessageFactory.java


示例8: channelRead0

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
@Override
protected void channelRead0(ChannelHandlerContext ctx, MqttMessage msg) throws Exception {
	switch (msg.fixedHeader().messageType()) {
	case PUBLISH:
		if (receiver != null) {
			receiver.messageReceived(Message.newMessage(client.clientId(), (MqttPublishMessage) msg));
		}

		int messageId = ((MqttPublishMessage) msg).variableHeader().messageId();
		if (((MqttPublishMessage) msg).fixedHeader().qosLevel() == MqttQoS.AT_LEAST_ONCE) {
			client.send(MqttMessageFactory.puback(messageId));
		}
		else if (((MqttPublishMessage) msg).fixedHeader().qosLevel() == MqttQoS.EXACTLY_ONCE) {
			client.send(MqttMessageFactory.pubrec(messageId));
		}
		break;

	case CONNACK:
		sharedObject.receivedMessage(msg);

		synchronized (sharedObject.locker()) {
			sharedObject.locker().notify();
		}
		break;

	case PUBREC:
		client.send(MqttMessageFactory.pubrel(((MqttMessageIdVariableHeader) msg.variableHeader()).messageId()));
		break;

	case SUBACK:
	case PUBACK:
	case PUBCOMP:
	default:
		break;
	}
}
 
开发者ID:anyflow,项目名称:lannister,代码行数:37,代码来源:MqttPacketReceiver.java


示例9: publishReceived

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
/**
 * Sends PUBREC packet to server
 *
 * @param publishMessage a PUBLISH message to acknowledge
 */
void publishReceived(MqttPublishMessage publishMessage) {

  MqttFixedHeader fixedHeader =
    new MqttFixedHeader(MqttMessageType.PUBREC, false, AT_MOST_ONCE, false, 0);

  MqttMessageIdVariableHeader variableHeader =
    MqttMessageIdVariableHeader.from(publishMessage.messageId());

  io.netty.handler.codec.mqtt.MqttMessage pubrec = MqttMessageFactory.newMessage(fixedHeader, variableHeader, null);

  qos2inbound.put(publishMessage.messageId(), publishMessage);
  this.write(pubrec);
}
 
开发者ID:vert-x3,项目名称:vertx-mqtt,代码行数:19,代码来源:MqttClientImpl.java


示例10: publishRelease

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
/**
 * Sends the PUBREL message to server
 *
 * @param publishMessageId  identifier of the PUBLISH message to acknowledge
 */
void publishRelease(int publishMessageId) {

  MqttFixedHeader fixedHeader =
    new MqttFixedHeader(MqttMessageType.PUBREL, false, MqttQoS.AT_LEAST_ONCE, false, 0);

  MqttMessageIdVariableHeader variableHeader =
    MqttMessageIdVariableHeader.from(publishMessageId);

  io.netty.handler.codec.mqtt.MqttMessage pubrel = MqttMessageFactory.newMessage(fixedHeader, variableHeader, null);

  qos2outbound.put(publishMessageId, pubrel);
  this.write(pubrel);
}
 
开发者ID:vert-x3,项目名称:vertx-mqtt,代码行数:19,代码来源:MqttClientImpl.java


示例11: sendPublishProtocolControlMessage

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
void sendPublishProtocolControlMessage(int messageId, MqttMessageType messageType) {
   MqttQoS qos = (messageType == MqttMessageType.PUBREL) ? MqttQoS.AT_LEAST_ONCE : MqttQoS.AT_MOST_ONCE;
   MqttFixedHeader fixedHeader = new MqttFixedHeader(messageType, false, qos, // Spec requires 01 in header for rel
                                                     false, 0);
   MqttPubAckMessage rel = new MqttPubAckMessage(fixedHeader, MqttMessageIdVariableHeader.from(messageId));
   sendToClient(rel);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:8,代码来源:MQTTProtocolHandler.java


示例12: createUnSubAckMessage

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
private MqttMessage createUnSubAckMessage(int msgId) {
  MqttFixedHeader mqttFixedHeader = new MqttFixedHeader(UNSUBACK, false, AT_LEAST_ONCE, false, 0);
  MqttMessageIdVariableHeader mqttMessageIdVariableHeader = MqttMessageIdVariableHeader.from(msgId);
  return new MqttMessage(mqttFixedHeader, mqttMessageIdVariableHeader);
}
 
开发者ID:osswangxining,项目名称:iothub,代码行数:6,代码来源:MqttTransportHandler.java


示例13: createSubAckMessage

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
private static MqttSubAckMessage createSubAckMessage(Integer msgId, List<Integer> grantedQoSList) {
  MqttFixedHeader mqttFixedHeader = new MqttFixedHeader(SUBACK, false, AT_LEAST_ONCE, false, 0);
  MqttMessageIdVariableHeader mqttMessageIdVariableHeader = MqttMessageIdVariableHeader.from(msgId);
  MqttSubAckPayload mqttSubAckPayload = new MqttSubAckPayload(grantedQoSList);
  return new MqttSubAckMessage(mqttFixedHeader, mqttMessageIdVariableHeader, mqttSubAckPayload);
}
 
开发者ID:osswangxining,项目名称:iothub,代码行数:7,代码来源:MqttTransportHandler.java


示例14: createMqttPubAckMsg

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
public static MqttPubAckMessage createMqttPubAckMsg(int requestId) {
  MqttFixedHeader mqttFixedHeader = new MqttFixedHeader(PUBACK, false, AT_LEAST_ONCE, false, 0);
  MqttMessageIdVariableHeader mqttMsgIdVariableHeader = MqttMessageIdVariableHeader.from(requestId);
  return new MqttPubAckMessage(mqttFixedHeader, mqttMsgIdVariableHeader);
}
 
开发者ID:osswangxining,项目名称:iothub,代码行数:6,代码来源:MqttTransportHandler.java


示例15: createMqttPubAckMsg

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
private static MqttPubAckMessage createMqttPubAckMsg(int requestId) {
  MqttFixedHeader mqttFixedHeader = new MqttFixedHeader(PUBACK, false, AT_LEAST_ONCE, false, 0);
  MqttMessageIdVariableHeader mqttMsgIdVariableHeader = MqttMessageIdVariableHeader.from(requestId);
  return new MqttPubAckMessage(mqttFixedHeader, mqttMsgIdVariableHeader);
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:6,代码来源:JsonMqttAdaptor.java


示例16: subscribeAcknowledge

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
public MqttEndpointImpl subscribeAcknowledge(int subscribeMessageId, List<MqttQoS> grantedQoSLevels) {

    this.checkConnected();

    MqttFixedHeader fixedHeader =
      new MqttFixedHeader(MqttMessageType.SUBACK, false, MqttQoS.AT_MOST_ONCE, false, 0);
    MqttMessageIdVariableHeader variableHeader =
      MqttMessageIdVariableHeader.from(subscribeMessageId);

    MqttSubAckPayload payload = new MqttSubAckPayload(grantedQoSLevels.stream().mapToInt(MqttQoS::value).toArray());

    io.netty.handler.codec.mqtt.MqttMessage suback = MqttMessageFactory.newMessage(fixedHeader, variableHeader, payload);

    this.write(suback);

    return this;
  }
 
开发者ID:vert-x3,项目名称:vertx-mqtt,代码行数:18,代码来源:MqttEndpointImpl.java


示例17: getMessageId

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
private int getMessageId(MqttMessage message) {
   return ((MqttMessageIdVariableHeader) message.variableHeader()).messageId();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:4,代码来源:MQTTProtocolHandler.java


示例18: messageId

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
public static int messageId(MqttMessage msg) {
    return ((MqttMessageIdVariableHeader) msg.variableHeader()).messageId();
}
 
开发者ID:andsel,项目名称:moquette,代码行数:4,代码来源:Utils.java


示例19: publishAcknowledge

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
/**
 * Sends PUBACK packet to server
 *
 * @param publishMessageId identifier of the PUBLISH message to acknowledge
 */
void publishAcknowledge(int publishMessageId) {

  MqttFixedHeader fixedHeader =
    new MqttFixedHeader(MqttMessageType.PUBACK, false, AT_MOST_ONCE, false, 0);

  MqttMessageIdVariableHeader variableHeader =
    MqttMessageIdVariableHeader.from(publishMessageId);

  io.netty.handler.codec.mqtt.MqttMessage puback = MqttMessageFactory.newMessage(fixedHeader, variableHeader, null);

  this.write(puback);
}
 
开发者ID:vert-x3,项目名称:vertx-mqtt,代码行数:18,代码来源:MqttClientImpl.java


示例20: publishComplete

import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; //导入依赖的package包/类
/**
 * Sends PUBCOMP packet to server
 *
 * @param publishMessageId identifier of the PUBLISH message to acknowledge
 */
void publishComplete(int publishMessageId) {

  MqttFixedHeader fixedHeader =
    new MqttFixedHeader(MqttMessageType.PUBCOMP, false, AT_MOST_ONCE, false, 0);

  MqttMessageIdVariableHeader variableHeader =
    MqttMessageIdVariableHeader.from(publishMessageId);

  io.netty.handler.codec.mqtt.MqttMessage pubcomp = MqttMessageFactory.newMessage(fixedHeader, variableHeader, null);

  this.write(pubcomp);
}
 
开发者ID:vert-x3,项目名称:vertx-mqtt,代码行数:18,代码来源:MqttClientImpl.java



注:本文中的io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ReplicationSyncUp类代码示例发布时间:2022-05-23
下一篇:
Java ShibbolethCompatiblePersistentIdGenerator类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap