wenfengwang commented on a change in pull request #12: More Configurable fields
and mores
URL: https://github.com/apache/rocketmq-client-go/pull/12#discussion_r242018484
##########
File path: examples/producer.go
##########
@@ -24,20 +24,23 @@ import (
)
func main() {
- SendMessage()
-}
+ cfg := &rocketmq.ProducerConfig{}
+ cfg.GroupID = "testGroup"
+ cfg.NameServer = "47.101.55.250:9876"
+ producer, err := rocketmq.NewProducer(cfg)
+ if err != nil {
+ fmt.Println("create Producer failed, error:", err)
+ return
+ }
-func SendMessage() {
- producer := rocketmq.NewProducer(&rocketmq.ProducerConfig{GroupID:
"testGroup", NameServer: "localhost:9876"})
producer.Start()
defer producer.Shutdown()
fmt.Printf("Producer: %s started... \n", producer)
for i := 0; i < 100; i++ {
msg := fmt.Sprintf("Hello RocketMQ-%d", i)
- result := producer.SendMessageSync(&rocketmq.Message{Topic:
"test", Body: msg})
+ result := producer.SendMessageSync(&rocketmq.Message{Topic:
"wwf1", Body: msg})
Review comment:
sorry, i forgot change it back.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services