You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

30 lines
570 B

package main
import (
"fmt"
"github.com/seaweedfs/seaweedfs/weed/mq/client/sub_client"
)
func main() {
subscriber := sub_client.NewTopicSubscriber(
&sub_client.SubscriberConfiguration{
ConsumerGroup: "test",
ConsumerId: "test",
},
"test", "test")
if err := subscriber.Connect("localhost:17777"); err != nil {
fmt.Println(err)
return
}
if err := subscriber.Subscribe(func(key, value []byte) bool {
println(string(key), "=>", string(value))
return true
}, func() {
println("done subscribing")
}); err != nil {
fmt.Println(err)
}
}