Esempio n. 1
0
func healthCheckNSQ() (interface{}, error) {
	if err := nsq.Connect(meta.MC.NSQd[0]); err == nil {
		return fmt.Sprintf("%s up", meta.MC.NSQd[0]), nil
	} else {
		return nil, err
	}
}
Esempio n. 2
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)
		}
	}
}
Esempio n. 3
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)
	}
}