@@ -33,25 +33,29 @@ class RRTesting(
33
33
}
34
34
35
35
private val mapper = jacksonObjectMapper()
36
- private final val consumerExecutor: ExecutorService = Executors .newFixedThreadPool(5 )
36
+ private final val consumerExecutor: ExecutorService = Executors .newFixedThreadPool(20 )
37
37
38
38
fun test () {
39
39
40
40
41
41
val systemTopic: String = " SYSTEM_TOPIC"
42
42
val inputTopicA: String = " input-topic-a"
43
+ val inputTopicB: String = " input-topic-b"
43
44
44
45
runConsumer(systemTopic)
45
46
runConsumer(inputTopicA)
47
+ runConsumer(inputTopicB)
46
48
runConsumer(" gateway-01-clients-topic" )
47
49
runConsumer(" gateway-01-keys-topic" )
50
+ runConsumer(" gateway-02-clients-topic" )
51
+ runConsumer(" gateway-02-keys-topic" )
48
52
val props = Properties ()
49
53
props[" bootstrap.servers" ] = bootstrapServers
50
54
props[" key.serializer" ] = " org.apache.kafka.common.serialization.StringSerializer"
51
55
props[" value.serializer" ] = " org.apache.kafka.common.serialization.StringSerializer"
52
56
val producer: KafkaProducer <String , String > = KafkaProducer <String , String >(props)
53
57
54
- val newGatewayKeyTopic = SystemGatewayKeyTopic (" id " , " gateway-01-keys-topic" , " gateway-01-clients-topic" )
58
+ val newGatewayKeyTopic = SystemGatewayKeyTopic (" id1 " , " gateway-01-keys-topic" , " gateway-01-clients-topic" )
55
59
val newGatewayKeyTopicJson: String = mapper.writeValueAsString(newGatewayKeyTopic)
56
60
utils.printRed(" TEST newGatewayKeyTopicJson as string: \n $newGatewayKeyTopicJson " )
57
61
@@ -69,8 +73,29 @@ class RRTesting(
69
73
producer.send(ProducerRecord (inputTopicA, " 0" , " testvalue 3" ))
70
74
producer.send(ProducerRecord (inputTopicA, " 0" , " testvalue 4" ))
71
75
76
+ Thread .sleep(6000 )
72
77
78
+ val newGatewayKeyTopic2 = SystemGatewayKeyTopic (" id2" , " gateway-02-keys-topic" , " gateway-02-clients-topic" )
79
+ val newGatewayKeyTopicJson2: String = mapper.writeValueAsString(newGatewayKeyTopic2)
80
+ producer.send(ProducerRecord (systemTopic, " new-gateway-key-topic" , newGatewayKeyTopicJson2))
73
81
82
+ Thread .sleep(1000 )
83
+
84
+ producer.send(ProducerRecord (newGatewayKeyTopic2.keysTopicName, inputTopicA, mapper.writeValueAsString(listOf (" 1" , " 2" ))))
85
+ producer.send(ProducerRecord (newGatewayKeyTopic2.keysTopicName, inputTopicB, mapper.writeValueAsString(listOf (" 5" , " 6" ))))
86
+
87
+ Thread .sleep(2000 )
88
+
89
+ producer.send(ProducerRecord (inputTopicA, " 0" , " testvalue 10" ))
90
+ producer.send(ProducerRecord (inputTopicA, " 0" , " testvalue 11" ))
91
+ producer.send(ProducerRecord (inputTopicA, " 1" , " testvalue 12" ))
92
+ producer.send(ProducerRecord (inputTopicA, " 1" , " testvalue 13" ))
93
+ producer.send(ProducerRecord (inputTopicA, " 2" , " testvalue 14" ))
94
+
95
+ producer.send(ProducerRecord (inputTopicB, " 1" , " no 13" ))
96
+ producer.send(ProducerRecord (inputTopicB, " 2" , " no 14" ))
97
+ producer.send(ProducerRecord (inputTopicB, " 5" , " yes 13" ))
98
+ producer.send(ProducerRecord (inputTopicB, " 6" , " yes 14" ))
74
99
75
100
}
76
101
0 commit comments