You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
546 B
Go
32 lines
546 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"strconv"
|
|
"time"
|
|
|
|
"zero/core/discov"
|
|
"zero/rq"
|
|
|
|
"github.com/google/gops/agent"
|
|
)
|
|
|
|
func main() {
|
|
if err := agent.Listen(agent.Options{}); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
pusher, err := rq.NewPusher([]string{"localhost:2379"}, "queue", rq.WithConsistentStrategy(
|
|
func(msg string) (string, string, error) {
|
|
return msg, msg, nil
|
|
}, discov.BalanceWithId()), rq.WithServerSensitive())
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
for i := 0; ; i++ {
|
|
pusher.Push(strconv.Itoa(i))
|
|
time.Sleep(time.Second)
|
|
}
|
|
}
|