github.com/sereiner/library@v0.0.0-20200518095232-1fa3e640cc5f/mq/kafka/kafka.message.go (about) 1 package kafka 2 3 4 import ( 5 "github.com/Shopify/sarama" 6 ) 7 8 type KafkaMessage struct { 9 msg *sarama.ConsumerMessage 10 Message string 11 } 12 13 //Ack 14 func (m *KafkaMessage) Ack() error { 15 return nil 16 //m.s.conn.Ack(m.msg.Headers) 17 } 18 func (m *KafkaMessage) Nack() error { 19 return nil 20 //m.s.conn.Nack(m.msg.Headers) 21 } 22 func (m *KafkaMessage) GetMessage() string { 23 return m.Message 24 } 25 26 //NewMessage 27 func NewKafkaMessage(msg *sarama.ConsumerMessage) *KafkaMessage { 28 //return &StompMessage{s: s, msg: msg, Message: string(msg.Body)} 29 return &KafkaMessage{msg: msg, Message: string(msg.Value)} 30 }