Ejemplo n.º 1
0
func main() {
	flag.Parse()
	producer.Connect(*nsqdAddr)

	for _ = range time.NewTicker(100 * time.Millisecond).C {
		fmt.Println("Ping...")
		for i := 0; i < *amount; i++ {
			body, _ := time.Now().MarshalBinary()
			producer.PublishAsync("latency-test", body, nil)
		}
	}
}
Ejemplo n.º 2
0
func main() {
	producer.Connect(nsqdAddr)

	var crawlJob struct {
		host string
	}
	crawlJob.host = "google.com"

	body, _ := producer.EncJson(crawlJob)
	for i := 0; i < 10000; i++ {
		producer.PublishAsync("crawl", body, nil)
		// producer.PublishJsonAsync("crawl", crawlJob, nil)
	}
}