Message publishing timestamp

1,762 views
Skip to first unread message

Jonatan Andres

unread,
Aug 4, 2015, 2:15:06 AM8/4/15
to rabbitmq-users
I've read about the "Message publishing timestamp", but this is set in the producer of the message.

Is there any way to set the timestamp in the message when it reaches rabbitmq (exchanges or queues)?

Thank you.

Michael Klishin

unread,
Aug 4, 2015, 6:24:30 AM8/4/15
to rabbitmq-users, Jonatan Andres
No, although this is something a plugin could do.

The idea is that RabbitMQ tries hard to not modify message metadata,
and never modifies message payload. In addition, your apps are more likely
to care about when other apps published a message than when it was enqueued
(at least we thought so).

The opposite may be desirable, of course. Can you explain what your use case is? 
--
MK

Staff Software Engineer, Pivotal/RabbitMQ


Jonatan Andres

unread,
Aug 4, 2015, 6:48:37 AM8/4/15
to rabbitmq-users, jonatan...@gmail.com

Thank you for your response!

 

Our simplified case is as follows:

 

We have several clients (producers) sending messages to a single server (only one consumer). If a producer’s message is queued (with other messages) and arrives late at the consumer, it will not come at the right time (and the client is not guilty, he has sent the message in time).

 

We can not trust the sending time of the producer (local machine), but if we could find the time it arrived to rabbit maybe we could accept the message.



Michael Klishin

unread,
Aug 4, 2015, 6:51:26 AM8/4/15
to rabbitmq-users, Jonatan Andres
On 4 August 2015 at 13:48:40, Jonatan Andres (jonatan...@gmail.com) wrote:
> Our simplified case is as follows:
>
> We have several clients (producers) sending messages to a single
> server (only one consumer). If a producer’s message is queued
> (with other messages) and arrives late at the consumer, it will
> not come at the right time (and the client is not guilty, he has
> sent the message in time).
>
> We can not trust the sending time of the producer (local machine),
> but if we could find the time it arrived to rabbit maybe we could
> accept the message.

Understood. If the idea is that outdated messages should not be processed,
message TTL should help.

If not, then you can have a separate tiny app that only consumes messages,
timestamps them and re-publishes to the server. This may be easier and much quicker
than developing a plugin.

Alvaro Videla

unread,
Aug 17, 2015, 11:31:14 AM8/17/15
to Michael Klishin, rabbitmq-users, Jonatan Andres
See this new plugin: https://github.com/rabbitmq/rabbitmq-message-timestamp

It only works with RabbitMQ master or future 3.6.0 tho.

-Alvaro

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send an email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrea Rosa

unread,
Aug 19, 2015, 12:36:03 PM8/19/15
to rabbitmq-users, mkli...@pivotal.io, jonatan...@gmail.com


On Monday, 17 August 2015 16:31:14 UTC+1, Alvaro Videla wrote:
See this new plugin: https://github.com/rabbitmq/rabbitmq-message-timestamp

It only works with RabbitMQ master or future 3.6.0 tho.

The timestamp is added once the message get in a queue or when it is processed by RMQ?
Thanks
--
Andrea 

Alvaro Videla

unread,
Aug 19, 2015, 12:40:33 PM8/19/15
to rabbitm...@googlegroups.com, Michael Klishin, Jonatan Andres
The timestamp is added as soon as RabbitMQ processes `basic.publish`. This means the timestamp is added even if RabbitMQ won't route the message, due to non matching routing keys, no bound queues, and so on.

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.

Oytun Tez

unread,
Aug 31, 2018, 10:25:48 PM8/31/18
to rabbitmq-users
Do you think this is theoretically correct way, rather than stamping messages on the publisher directly? We are in a similar situation, where we will process the events with Apache Flink and Flink revolves around message timestamp. Putting the stamp in the publisher is also an ugly way, too distributed...

Michael Klishin

unread,
Sep 3, 2018, 5:59:47 PM9/3/18
to rabbitm...@googlegroups.com
Both [1] (which didn't exist at the time this thread was started in 2015) and making publishers
timestamp messages have the same issue: wall clock synchronisation.

If you find it more convenient to use [1], do it. There's nothing wrong with making your publishers
do it either, just requires a bit more discipline and more machines to worry about when it comes to reliable
wall clock synchronisation using NTP.


To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages