| 
					
				 | 
			
			
				@@ -8,18 +8,18 @@ import org.springframework.kafka.listener.MessageListener; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.text.SimpleDateFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.HashSet; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Slf4j 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @AllArgsConstructor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class TsiKafkaConsumerWorker implements MessageListener<String, byte[]> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private final String topic; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private final String nodeId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private final String TEST_TOPIC = "topic-for-ssd-test"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private final HashSet<String> keyValues; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void onMessage(ConsumerRecord<String, byte[]> record) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (!this.nodeId.equals(record.key())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!this.keyValues.contains(record.key())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -28,8 +28,10 @@ public class TsiKafkaConsumerWorker implements MessageListener<String, byte[]> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         byte[] buffer = record.value(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int idx = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int tail = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if ("cvim-raw".equals(this.topic)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             idx = 27 + 6; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //tail = -2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         else if ("topic-for-ssd-test".equals(this.topic)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             int stx1    = buffer[idx++]; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -40,11 +42,12 @@ public class TsiKafkaConsumerWorker implements MessageListener<String, byte[]> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             log.info("STX1: {}, STX2: {}, Length: {}, OpCode: {}, Version: {}, Idx: {}", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     stx1, stx2, length, opCode, version, idx); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //idx = 6; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tail = -2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        displayPacket(record.key(), record.value(), idx); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        displayPacket(record.key(), record.value(), idx, tail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public static void displayPacket(String topicKey, byte[] buffer, int start) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static void displayPacket(String topicKey, byte[] buffer, int start, int tail) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int idx = start; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //        int stx1    = buffer[idx++]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //        int stx2    = buffer[idx++]; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -112,7 +115,7 @@ public class TsiKafkaConsumerWorker implements MessageListener<String, byte[]> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //} tsc_cvim_hdr_t, *ptsc_cvim_hdr_t; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         final int SIGNAL_STATUS_SIZE = 5; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        int remainLength = buffer.length - idx; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int remainLength = buffer.length - idx + tail; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (statusCount * SIGNAL_STATUS_SIZE != remainLength) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             log.error("Signal Status Data length error: {} EA, {}, {}", statusCount, statusCount * SIGNAL_STATUS_SIZE, remainLength); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return; 
			 |