Exemple #1
0
func (self *kiteClient) sendMessage(message *protocol.QMessage) error {

	data, err := protocol.MarshalPbMessage(message.GetPbMessage())
	if nil != err {
		return err
	}
	timeout := 3 * time.Second
	return self.innerSendMessage(message.GetMsgType(), data, timeout)
}
Exemple #2
0
//创建stringmessage
func NewMessageEntity(msg *protocol.QMessage) *MessageEntity {
	entity := &MessageEntity{
		Header:       msg.GetHeader(),
		Body:         msg.GetBody(),
		MessageId:    msg.GetHeader().GetMessageId(),
		Topic:        msg.GetHeader().GetTopic(),
		MessageType:  msg.GetHeader().GetMessageType(),
		PublishGroup: msg.GetHeader().GetGroupId(),
		Commit:       msg.GetHeader().GetCommit(),
		ExpiredTime:  msg.GetHeader().GetExpiredTime(),
		DeliverCount: 0,
		DeliverLimit: msg.GetHeader().GetDeliverLimit(),

		//消息种类
		MsgType: msg.GetMsgType()}
	return entity

}