func SendNormalMessageAsync()

in golang/utils/ClientUtils.go [239:257]


func SendNormalMessageAsync(producer rmq_client.Producer, topic string, body string, tag string, sendNum int, keys ...string) *SendMsgsCollector {
	sendMsgCollector := NewSendMsgsCollector()
	// new a message
	msg := BuildNormalMessage(topic, body, tag, keys...)
	for i := 0; i < sendNum; i++ {
		// send message in async
		producer.SendAsync(context.TODO(), msg, func(ctx context.Context, resp []*rmq_client.SendReceipt, err error) {
			if err != nil {
				log.Fatal(err)
			}
			for i := 0; i < len(resp); i++ {
				sendMsgCollector.MsgIds = append(sendMsgCollector.MsgIds, resp[i].MessageID)
				sendMsgCollector.SendMsgs = append(sendMsgCollector.SendMsgs, msg)
				fmt.Printf("%#v\n", resp[i])
			}
		})
	}
	return sendMsgCollector
}