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 {} }
func (handle) HandleMessage(message *nsq.Message) error { time.Sleep(time.Millisecond * 3) common.NsqPublish("test_topic1", message.Body) return nil }