10

Is there a way to get the timestamp when a message was placed on the queue, from a consumer. Not when it was published, but when it actually made it to the queue.

Dmitry
  • 1,513
  • 1
  • 15
  • 33
  • Unless I'm missing something, seems like, short of writing a rabbitmq plugin, there isn't :( – Dmitry May 03 '12 at 15:05
  • Possible duplicate of [RabbitMQ 3.1.3 and the missing timestamp header](https://stackoverflow.com/questions/18002472/rabbitmq-3-1-3-and-the-missing-timestamp-header) – Alexander Puchkov May 14 '18 at 15:55

2 Answers2

6

No there's no way to figure this out, unless, as you state yourself you write a plugin for this. There is nothing in the AMQP specification that says that the message must know when it arrived in the queue.

There is no need from the AMQP point of view to know this. There are also many cases when the message might pass through several queues and then which queue should represent the relevant timestamp?

Daniel Figueroa
  • 10,348
  • 5
  • 44
  • 66
  • Even as you say that the message might pass through several queues all I want is the timestamp when the message is places on that queue only. so there is an obvious use case and need for the timestamp. – Mani Jun 24 '15 at 11:54
  • @Mani It doesn't seem obvious to me. Which application needs to know? The publisher, the consumer or something else? – Doug Dawson May 14 '18 at 15:34
0

A duplicate question has a good answer https://stackoverflow.com/a/33640262/1689049:

As of 2015, there are new answers for the original question.

This plugin will do exactly what you were looking for.

Take in mind there will be some minimal overhead since it will hook all messages being queued.

Alexander Puchkov
  • 5,913
  • 4
  • 34
  • 48
  • If you think it's a duplicate, vote to close instead of copying the answers (it's with attribution so I have no intention of mod-flagging or calling it plagiarism, but it's not good practice. Close the question if you think it's a dupe) – Zoe May 14 '18 at 15:28
  • @Zoe you see, this question has been asked before the other one with a newer better answer. So technically the other question with a good answer is a duplicate. Do we still want to mark this one as a dupe? – Alexander Puchkov May 14 '18 at 15:41
  • If it's the same question, you could request to have them [merged](https://meta.stackoverflow.com/questions/312091/what-is-the-correct-procedure-for-requesting-that-two-questions-be-merged). Otherwise [close the bad one](https://meta.stackoverflow.com/questions/258697/should-we-really-mark-new-questions-as-duplicates-of-old-crappy-ones) as a duplicate – Zoe May 14 '18 at 15:48