Browse Source

no message

wangwendongVMMacOS 3 years ago
parent
commit
2a7d4ce149

+ 4 - 8
src/main/java/com/persagy/ztkedgeclouddatasecurity/kafka/EdgeKakfaConsumer.java

@@ -24,7 +24,7 @@ public class EdgeKakfaConsumer {
     public NettyClient nettyClient;
 
     @KafkaListener(topicPattern = "Cloud_.*")
-    public void topicList(ConsumerRecord<?, ?> record, Acknowledgment ack, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) {
+    public void topicList(ConsumerRecord<?, ?> record, Acknowledgment ack, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) throws InterruptedException {
 
 
         //System.out.println("............"+record.value());
@@ -35,13 +35,9 @@ public class EdgeKakfaConsumer {
             String[] TopicArr = topic.split("_");
             if ("zkt-proj-alarm".equals(TopicArr[2])){
                 JSONObject.parseObject(JSONObject.toJSONString(msg)).getObject("msg", NettyMessage.class);
-                try {
-                  //  nettyClient.sendMessage(JSONObject.parseObject(JSONObject.toJSONString(msg)).getObject("msg", NettyMessage.class));
-                    if (ack != null) {
-                        ack.acknowledge();
-                    }
-                } catch (InterruptedException e) {
-                    log.error(e.getMessage(),e);
+                //  nettyClient.sendMessage(JSONObject.parseObject(JSONObject.toJSONString(msg)).getObject("msg", NettyMessage.class));
+                if (ack != null) {
+                    ack.acknowledge();
                 }
 
             }