This commit is contained in:
chrislu
2024-01-28 12:23:20 -08:00
parent b51dfe2bff
commit cbf750a31f
4 changed files with 19 additions and 31 deletions

View File

@@ -4,6 +4,7 @@ import (
"flag"
"fmt"
"github.com/seaweedfs/seaweedfs/weed/mq/client/pub_client"
"github.com/seaweedfs/seaweedfs/weed/mq/topic"
"log"
"strings"
"sync"
@@ -16,7 +17,7 @@ var (
partitionCount = flag.Int("p", 6, "partition count")
namespace = flag.String("ns", "test", "namespace")
topic = flag.String("topic", "test", "topic")
t = flag.String("t", "test", "t")
seedBrokers = flag.String("brokers", "localhost:17777", "seed brokers")
)
@@ -39,10 +40,11 @@ func doPublish(publisher *pub_client.TopicPublisher, id int) {
func main() {
flag.Parse()
config := &pub_client.PublisherConfiguration{
Topic: topic.NewTopic(*namespace, *t),
CreateTopic: true,
CreateTopicPartitionCount: int32(*partitionCount),
}
publisher := pub_client.NewTopicPublisher(*namespace, *topic, config)
publisher := pub_client.NewTopicPublisher(config)
wg := sync.WaitGroup{}
wg.Add(1)
go func() {