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.
go-zero/example/beanstalk/producer/producer.go

41 lines
590 B
Go

4 years ago
package main
import (
"fmt"
"strconv"
"time"
"zero/dq"
)
func main() {
producer := dq.NewProducer([]dq.Beanstalk{
{
Endpoint: "localhost:11300",
Tube: "tube",
},
{
Endpoint: "localhost:11301",
Tube: "tube",
},
{
Endpoint: "localhost:11302",
Tube: "tube",
},
{
Endpoint: "localhost:11303",
Tube: "tube",
},
{
Endpoint: "localhost:11304",
Tube: "tube",
},
})
for i := 0; i < 5; i++ {
_, err := producer.At([]byte(strconv.Itoa(i)), time.Now().Add(time.Second*10))
if err != nil {
fmt.Println(err)
}
}
}