1
0
mirror of https://github.com/eventials/goevents.git synced 2025-04-24 13:48:53 +08:00

fix msg timestamp when publish

This commit is contained in:
Guilherme Raduenz 2020-10-21 21:38:41 -03:00
parent 978c81a1c1
commit 04bec7e32d
2 changed files with 5 additions and 4 deletions

View File

@ -194,9 +194,10 @@ func (c *consumer) doDispatch(msg amqplib.Delivery, h *handler, retryCount int32
}
log := logger.WithFields(logrus.Fields{
"action": h.action,
"body": string(msg.Body),
"message_id": msg.MessageId,
"action": h.action,
"body": string(msg.Body),
"message_id": msg.MessageId,
"published_at": msg.Timestamp.String(),
})
if err == nil {

View File

@ -95,7 +95,7 @@ func (p *producer) Publish(action string, data []byte) {
Timestamp: now,
Body: data,
Headers: amqp.Table{
"x-epoch-milli": now.Unix() / int64(time.Millisecond),
"x-epoch-milli": int64(now.UnixNano()/int64(time.Nanosecond)) / int64(time.Millisecond),
},
})
}