publish to input buffer

currently, the input buffer may not exist when start to publish
This commit is contained in:
chrislu
2024-01-27 23:43:22 -08:00
parent 5dc1362bdc
commit 841fafd0a8
7 changed files with 103 additions and 134 deletions

View File

@@ -30,7 +30,7 @@ func doPublish(publisher *pub_client.TopicPublisher, id int) {
fmt.Println(err)
break
}
// println("Published", string(key), string(value))
println("Published", string(key), string(value))
}
elapsed := time.Since(startTime)
log.Printf("Publisher %d finished in %s", id, elapsed)
@@ -43,11 +43,13 @@ func main() {
CreateTopicPartitionCount: int32(*partitionCount),
}
publisher := pub_client.NewTopicPublisher(*namespace, *topic, config)
brokers := strings.Split(*seedBrokers, ",")
if err := publisher.Connect(brokers); err != nil {
fmt.Println(err)
return
}
go func() {
brokers := strings.Split(*seedBrokers, ",")
if err := publisher.StartSchedulerThread(brokers); err != nil {
fmt.Println(err)
return
}
}()
startTime := time.Now()