예제 #1
0
func HandleCrawl(message *consumer.Message) {
	var crawlMessage struct {
		Host string
	}

	err := message.ReadJson(&crawlMessage)
	if err != nil {
		log.Printf("Error decoding json msg: %v\n", err)
		message.GiveUp()
		return
	}

	log.Printf("new msg: %s\n", crawlMessage.Host)
	message.Success()
}
예제 #2
0
func HandleTest(msg *consumer.Message) {
	t := &time.Time{}
	t.UnmarshalBinary(msg.Body)
	fmt.Printf("Consume latency: %s\n", time.Since(*t))
	msg.Success()
}