Browse Source

日志增加offset

wuwenjun 2 years ago
parent
commit
82513417c6

+ 2 - 2
src/main/java/com/persagy/iottransfer/kafka/KafkaConsumerCloud2Edge.java

@@ -33,7 +33,7 @@ public class KafkaConsumerCloud2Edge {
             String projectId = packetEntity.getProjectId();
             Packet packet = packetEntity.getContent();
             IotServer.tcpCollectServerManager.AppendToSendByProject(projectId, packet);
-            log.info("topicCollect2Edge 消费了: Topic:" + topic + ",Message:" + packetEntity);
+            log.info("topicCollect2Edge 消费了: Topic:" + topic + ",Message:" + packetEntity + ",Offset:" + record.offset());
             ack.acknowledge();
         }
     }
@@ -46,7 +46,7 @@ public class KafkaConsumerCloud2Edge {
             String projectId = packetEntity.getProjectId();
             Packet packet = packetEntity.getContent();
             IotServer.tcpControlServerManager.AppendToSendByProject(projectId, packet);
-            log.info("topicControl2Edge 消费了: Topic:" + topic + ",Message:" + packetEntity);
+            log.info("topicControl2Edge 消费了: Topic:" + topic + ",Message:" + packetEntity + ",Offset:" + record.offset());
             ack.acknowledge();
         }
     }

+ 2 - 2
src/main/java/com/persagy/iottransfer/kafka/KafkaConsumerEdge2Cloud.java

@@ -32,7 +32,7 @@ public class KafkaConsumerEdge2Cloud {
         try {
             if (message.isPresent()) {
                 String msg = message.get();
-                log.info("topic iot.edge2collect------消费了: Topic:" + topic + ",Message:" + msg);
+                log.info("topic iot.edge2collect------消费了: Topic:" + topic + ",Message:" + msg + ",Offset:" + record.offset());
                 PacketEntity packetEntity = JSONObject.parseObject(msg, PacketEntity.class);
                 IClientManager clientManager = IotClient.CLIENT_PROJECT_2_COLLECT_MANAGER_MAP.get(packetEntity.getProjectId());
                 clientManager.AppendToSend(packetEntity.content);
@@ -49,7 +49,7 @@ public class KafkaConsumerEdge2Cloud {
         try {
             if (message.isPresent()) {
                 String msg = message.get();
-                log.info("topic iot.edge2control------消费了: Topic:" + topic + ",Message:" + msg);
+                log.info("topic iot.edge2control------消费了: Topic:" + topic + ",Message:" + msg+ ",Offset:" + record.offset());
                 PacketEntity packetEntity = JSONObject.parseObject(msg, PacketEntity.class);
                 IClientManager clientManager = IotClient.CLIENT_PROJECT_2_CONTROL_MANAGER_MAP.get(packetEntity.getProjectId());
                 if (clientManager != null) {