wangchuanjin 4 jaren geleden
bovenliggende
commit
b6139d9918
3 gewijzigde bestanden met toevoegingen van 2 en 3 verwijderingen
  1. 1 1
      main.go
  2. BIN
      message.exe
  3. 1 2
      test/main_test.go

+ 1 - 1
main.go

@@ -11,7 +11,7 @@ import (
 func main() {
 	// Instantiate a consumer that will subscribe to the provided channel.
 	config := nsq.NewConfig()
-	consumer, err := nsq.NewConsumer("jypoints", "channel", config)
+	consumer, err := nsq.NewConsumer("jy_event", "points", config)
 	if err != nil {
 		log.Fatal(err)
 	}

BIN
message.exe


+ 1 - 2
test/main_test.go

@@ -45,11 +45,10 @@ func Test_Producer(t *testing.T) {
 		E_time:   time.Now().Unix(), //1605223065
 		E_app:    "jywx_node",
 	}
-	topicName := "jypoints"
 	// Synchronously publish a single message to the specified topic.
 	// Messages can also be sent asynchronously and/or in batches.
 	b, _ := json.Marshal(msg)
-	err = producer.Publish(topicName, b)
+	err = producer.Publish("jy_event", b)
 	if err != nil {
 		log.Println(err)
 		return