协议消息解析失败

mznpcxlj  于 2021-06-06  发布在  Kafka
关注(0)|答案(0)|浏览(1429)

post遥测消息已发布到kafka主题,规则引擎在解析遥测消息时失败。后遥测信息的有效载荷是多少?
我们通过使用kafka节点从规则引擎向kafka主题发布post遥测消息来模拟场景。但是当规则引擎解析来自kafka主题的post-telemetry消息时,它抛出以下错误

com.google.protobuf.InvalidProtocolBufferException: While parsing a protocol message, the input ended unexpectedly in the middle of a field.  This could mean either that the input has been truncated or that an embedded message misreported its own length

2019-04-05 18:37:06,455 [Akka-rule-dispatcher-71] DEBUG o.t.s.a.ruleChain.RuleChainActor - Processing msg: RuleNodeToRuleChainTellNextMsg(originator=30454c20-5560-11e9-8a39-513b18f007c6, relationTypes=[Success], msg=TbMsg(id=d031d960-57d1-11e9-af3f-ad9edc414a87, type=POST_TELEMETRY_REQUEST, originator=46b20440-555a-11e9-9049-e5861a1c8c53, metaData=TbMsgMetaData(data={deviceType=default, offset=2, userName=tenant@thingsboard.org, userId=4642a0a0-555a-11e9-9049-e5861a1c8c53, deviceName=Test Device A1, partition=2, scope=SERVER_SCOPE, topic=tb.rule-engine, ts=1554489426443}), dataType=JSON, data={"Temperature":"99"}, transactionData=TbMsgTransactionData(transactionId=d031d960-57d1-11e9-af3f-ad9edc414a87, originatorId=46b20440-555a-11e9-9049-e5861a1c8c53), ruleChainId=461a3110-555a-11e9-9049-e5861a1c8c53, ruleNodeId=null, clusterPartition=0))
2019-04-05 18:37:06,455 [Akka-rule-dispatcher-71] TRACE o.t.s.a.r.RuleChainActorMessageProcessor - [45f9b0c0-555a-11e9-9049-e5861a1c8c53][30149f30-5560-11e9-8a39-513b18f007c6][d031d960-57d1-11e9-af3f-ad9edc414a87] No outbound relations to process
2019-04-05 18:37:06,456 [pool-9-thread-1] TRACE o.t.s.s.t.RemoteRuleEngineTransportService - Processing 1 records
2019-04-05 18:37:06,456 [pool-9-thread-1] WARN  o.t.s.s.t.RemoteRuleEngineTransportService - Failed to process the notification.
com.google.protobuf.InvalidProtocolBufferException: While parsing a protocol message, the input ended unexpectedly in the middle of a field.  This could mean either that the input has been truncated or that an embedded message misreported its own length.
        at com.google.protobuf.InvalidProtocolBufferException.truncatedMessage(InvalidProtocolBufferException.java:82)
        at com.google.protobuf.CodedInputStream.skipRawBytesSlowPath(CodedInputStream.java:1284)
        at com.google.protobuf.CodedInputStream.skipRawBytes(CodedInputStream.java:1267)
        at com.google.protobuf.CodedInputStream.skipField(CodedInputStream.java:187)
        at com.google.protobuf.CodedInputStream.skipMessage(CodedInputStream.java:263)
        at com.google.protobuf.CodedInputStream.skipField(CodedInputStream.java:190)
        at org.thingsboard.server.gen.transport.TransportProtos$ToRuleEngineMsg.<init>(TransportProtos.java:22821)
        at org.thingsboard.server.gen.transport.TransportProtos$ToRuleEngineMsg.<init>(TransportProtos.java:22790)
        at org.thingsboard.server.gen.transport.TransportProtos$ToRuleEngineMsg$1.parsePartialFrom(TransportProtos.java:23316)
        at org.thingsboard.server.gen.transport.TransportProtos$ToRuleEngineMsg$1.parsePartialFrom(TransportProtos.java:23311)
        at com.google.protobuf.AbstractParser.parsePartialFrom(AbstractParser.java:139)
        at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:173)
        at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:185)
        at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:190)
        at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:49)
        at org.thingsboard.server.gen.transport.TransportProtos$ToRuleEngineMsg.parseFrom(TransportProtos.java:22962)
        at org.thingsboard.server.service.transport.ToRuleEngineMsgDecoder.decode(ToRuleEngineMsgDecoder.java:29)
        at org.thingsboard.server.service.transport.To

19-04-05 18:37:06,456 [pool-9-thread-1] WARN  o.t.s.s.t.RemoteRuleEngineTransportService - Failed to process the notification.
com.google.protobuf.InvalidProtocolBufferException: While parsing a protocol message, the input ended unexpectedly in the middle of a field.  This could mean either that the input has been truncated or that an embedded message misreported its own length.
        at com.google.protobuf.InvalidProtocolBufferException.truncatedMessage(InvalidProtocolBufferException.java:82)

这是我用来发送有效载荷给Kafka的脚本

enter code here 
var ms = Date.now();
msg = { "Temperature" :"99" };
msgType = "POST_TELEMETRY_REQUEST";
metadata.deviceType = "default";
metadata.deviceName = "Test Device A1";
metadata.ts=ms;
return { msg: msg,metadata: metadata,msgType: msgType };

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题