You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2019/01/10 14:50:10 UTC

[GitHub] ShannonDing closed pull request #26: fix:The specified topic does not take effect when run main.go

ShannonDing closed pull request #26: fix:The specified topic does not take effect when run main.go
URL: https://github.com/apache/rocketmq-client-go/pull/26
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/examples/producer.go b/examples/producer.go
index 01e8105..e1c4d2f 100644
--- a/examples/producer.go
+++ b/examples/producer.go
@@ -40,7 +40,7 @@ func sendMessage(config *rocketmq.ProducerConfig) {
 	fmt.Printf("Producer: %s started... \n", producer)
 	for i := 0; i < *amount; i++ {
 		msg := fmt.Sprintf("%s-%d", *body, i)
-		result, err := producer.SendMessageSync(&rocketmq.Message{Topic: "test", Body: msg})
+		result, err := producer.SendMessageSync(&rocketmq.Message{Topic: *topic, Body: msg})
 		if err != nil {
 			fmt.Println("Error:", err)
 		}
diff --git a/examples/push_consumer.go b/examples/push_consumer.go
index 723e32f..38e434c 100644
--- a/examples/push_consumer.go
+++ b/examples/push_consumer.go
@@ -34,7 +34,7 @@ func ConsumeWithPush(config *rocketmq.PushConsumerConfig) {
 	ch := make(chan interface{})
 	var count = (int64)(*amount)
 	// MUST subscribe topic before consumer started.
-	consumer.Subscribe("test", "*", func(msg *rocketmq.MessageExt) rocketmq.ConsumeStatus {
+	consumer.Subscribe(*topic, "*", func(msg *rocketmq.MessageExt) rocketmq.ConsumeStatus {
 		fmt.Printf("A message received: \"%s\" \n", msg.Body)
 		if atomic.AddInt64(&count, -1) <= 0 {
 			ch <- "quit"


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services