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

Java MqttPublishVariableHeader类代码示例

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

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



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

示例1: doMessage

import io.netty.handler.codec.mqtt.MqttPublishVariableHeader; //导入依赖的package包/类
public MqttMessage doMessage(MqttMessage msg) {
    logger.debug("MQTT PUBACK");

    MqttPublishVariableHeader publishVariableHeader = (MqttPublishVariableHeader) msg.variableHeader();
    int packetId = publishVariableHeader.packetId();
    ManagerHandler.removeSendedMessage(packetId);

    return null;
}
 
开发者ID:airballcz,项目名称:iot-platform,代码行数:10,代码来源:PubAckHandler.java


示例2: createMqttPublishMsg

import io.netty.handler.codec.mqtt.MqttPublishVariableHeader; //导入依赖的package包/类
private MqttPublishMessage createMqttPublishMsg(DeviceSessionCtx ctx, String topic, JsonElement json) {
  MqttFixedHeader mqttFixedHeader = new MqttFixedHeader(MqttMessageType.PUBLISH, false, MqttQoS.AT_LEAST_ONCE, false,
      0);
  MqttPublishVariableHeader header = new MqttPublishVariableHeader(topic, ctx.nextMsgId());
  ByteBuf payload = ALLOCATOR.buffer();
  payload.writeBytes(GSON.toJson(json).getBytes(UTF8));
  return new MqttPublishMessage(mqttFixedHeader, header, payload);
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:9,代码来源:JsonMqttAdaptor.java


示例3: send

import io.netty.handler.codec.mqtt.MqttPublishVariableHeader; //导入依赖的package包/类
protected void send(int messageId, String topicName, int qosLevel, boolean isRetain, ByteBuf payload, int deliveryCount) {
   boolean redelivery = qosLevel == 0 ? false : (deliveryCount > 0);
   MqttFixedHeader header = new MqttFixedHeader(MqttMessageType.PUBLISH, redelivery, MqttQoS.valueOf(qosLevel), isRetain, 0);
   MqttPublishVariableHeader varHeader = new MqttPublishVariableHeader(topicName, messageId);
   MqttMessage publish = new MqttPublishMessage(header, varHeader, payload);
   sendToClient(publish);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:8,代码来源:MQTTProtocolHandler.java


示例4: publish

import io.netty.handler.codec.mqtt.MqttPublishVariableHeader; //导入依赖的package包/类
public static MqttPublishMessage publish(IMessage message, boolean isDup) {
	MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.PUBLISH, isDup, message.qos(),
			message.isRetain(), 7 + message.message().length);

	MqttPublishVariableHeader variableHeader = new MqttPublishVariableHeader(message.topicName(), message.id());

	ByteBuf buf = PooledByteBufAllocator.DEFAULT.buffer(message.message().length);

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


示例5: createPublishMessage

import io.netty.handler.codec.mqtt.MqttPublishVariableHeader; //导入依赖的package包/类
private MqttPublishMessage createPublishMessage() {

    MqttFixedHeader mqttFixedHeader =
      new MqttFixedHeader(MqttMessageType.PUBLISH, false, MqttQoS.AT_LEAST_ONCE, true, 0);

    MqttPublishVariableHeader mqttPublishVariableHeader = new MqttPublishVariableHeader(MQTT_TOPIC, 1);

    ByteBuf payload =  ALLOCATOR.buffer();
    payload.writeBytes(MQTT_MESSAGE.getBytes(CharsetUtil.UTF_8));

    return new MqttPublishMessage(mqttFixedHeader, mqttPublishVariableHeader, payload);
  }
 
开发者ID:vert-x3,项目名称:vertx-mqtt,代码行数:13,代码来源:MqttServerBadClientTest.java


示例6: createPublishMessage

import io.netty.handler.codec.mqtt.MqttPublishVariableHeader; //导入依赖的package包/类
private MqttPublishMessage createPublishMessage() {

        MqttFixedHeader mqttFixedHeader =
                new MqttFixedHeader(MqttMessageType.PUBLISH, false, MqttQoS.AT_LEAST_ONCE, true, 0);

        MqttPublishVariableHeader mqttPublishVariableHeader = new MqttPublishVariableHeader(MQTT_TOPIC, 1);

        ByteBuf payload =  ALLOCATOR.buffer();
        payload.writeBytes(MQTT_MESSAGE.getBytes(CharsetUtil.UTF_8));

        return new MqttPublishMessage(mqttFixedHeader, mqttPublishVariableHeader, payload);
    }
 
开发者ID:EnMasseProject,项目名称:enmasse,代码行数:13,代码来源:ConnectionTest.java


示例7: addRetainMessage

import io.netty.handler.codec.mqtt.MqttPublishVariableHeader; //导入依赖的package包/类
/**
 * Add retain message for the topic name
 * Retain id will be generated
 *
 * @param topicLevels Topic Levels
 * @param msg         Retain Message
 * @return Retain Id
 */
int addRetainMessage(List<String> topicLevels, Message<MqttPublishVariableHeader, MqttPublishPayload> msg);
 
开发者ID:longkerdandy,项目名称:mithqtt,代码行数:10,代码来源:SyncStorage.java


示例8: getMatchRetainMessages

import io.netty.handler.codec.mqtt.MqttPublishVariableHeader; //导入依赖的package包/类
/**
 * Get all retain messages the topic name
 *
 * @param topicLevels Topic Levels
 * @return List of Retain Message
 */
List<Message<MqttPublishVariableHeader, MqttPublishPayload>> getMatchRetainMessages(List<String> topicLevels);
 
开发者ID:longkerdandy,项目名称:mithqtt,代码行数:8,代码来源:SyncStorage.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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