示例#1
0
文件: main1.go 项目: wxaxiaoyao/linux
func main() {
	max_count := 30000
	common.NsqConsumer("test_topic1", "test_channel", handle{})

	m := &Msg{}
	for i := 0; i < max_count; i++ {
		m.Id = int64(1000000 + i)
		m.Start_time = time.Now().Unix()
		common.NsqPublish("test_topic2", m.pack())
		time.Sleep(time.Millisecond)
	}

	fmt.Println("finish")
	select {}
}
示例#2
0
文件: main2.go 项目: wxaxiaoyao/linux
func (handle) HandleMessage(message *nsq.Message) error {
	time.Sleep(time.Millisecond * 3)
	common.NsqPublish("test_topic1", message.Body)
	return nil
}