Skip to content

Commit

Permalink
Merge pull request #27 from kinnou02/content-encoding
Browse files Browse the repository at this point in the history
Make content encoding configurable when publishing message
  • Loading branch information
rafaeljesus authored Apr 20, 2018
2 parents 3b40675 + dde12f7 commit 9b66eef
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rabbus.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ type (
ContentType string
// Headers the message application headers
Headers map[string]interface{}
// ContentEncoding the message encoding.
ContentEncoding string
}

// ListenConfig carries fields for listening messages.
Expand Down Expand Up @@ -261,10 +263,14 @@ func (r *Rabbus) produce(m Message) {
m.DeliveryMode = Persistent
}

if m.ContentEncoding == "" {
m.ContentEncoding = contentEncoding
}

opts := amqp.Publishing{
Headers: amqp.Table(m.Headers),
ContentType: m.ContentType,
ContentEncoding: contentEncoding,
ContentEncoding: m.ContentEncoding,
DeliveryMode: m.DeliveryMode,
Timestamp: time.Now(),
Body: m.Payload,
Expand Down

0 comments on commit 9b66eef

Please sign in to comment.