rabbitmq_message_timestamp: timestamp_in_ms value

311 views
Skip to first unread message

jonatan...@gmail.com

unread,
Jan 10, 2023, 3:13:47 AM1/10/23
to rabbitmq-users

Hi,

For diferent reasons, I need to obtain in an application using RabbitMQ the time (timestamp) at which messages arrive at RabbitMQ. I have successfully enabled the "rabbitmq_message_timestamp" plugin, but from what I see (in the code and in my tests) is that the plugin does not modify the value of the "timestamp_in_ms" property if it’s already set.

So, if a user sets that property to a value, the plugin will not modify it (and therefore we lose the real reference of the arrival to the server). I haven't found a way to prevent a user from setting that value, so right now I don't see any other option than modify and compile the plugin myself (which I don't like for several reasons, including that I have no Erlang knowledge). Is there any other way to get that timestamp from the server? Any other option/idea?

Personally, I think that this functionality is very useful in certain circumstances, and that it would be worth having it integrated into the RabbitMQ core itself.

Thanks!

Luke Bakken

unread,
Jan 11, 2023, 1:17:02 PM1/11/23
to rabbitmq-users
Hello,

It didn't take me long to implement this feature:


I would appreciate if you would test this out in your environment. To do so, follow these steps. Note that you should have Erlang and Elixir in your PATH for compilation to succeed. I tested with Erlang 23.2 and Elixir 1.14.2-otp-23

cd rabbitmq-message-timestamp
git checkout lukebakken/allow-clobber-timestamp_in_ms
make DIST_AS_EZS=true dist

Copy the generated plugins/rabbitmq_message_timestamp-3.11.1+1.g1063f8c.ez file to your RabbitMQ plugins directory

Create the /etc/rabbitmq/advanced.config file with this content (note that all characters are significant, including the trailing period), or add the rabbitmq_message_timestamp section to your existing advanced.config file:

[
    {rabbitmq_message_timestamp, [
        {overwrite_timestamps, true}
    ]}
].


Restart RabbitMQ, and ensure everything is set correctly by running these commands:

rabbitmq-plugins list
rabbitmqctl environment

The first command should return the updated version of the plugin, and the second should show the configuration setting in the output.

Thanks,
Luke

Luke Bakken

unread,
Jan 18, 2023, 10:59:19 AM1/18/23
to rabbitmq-users
Hello,

Please see this release which implements this new feature:

Reply all
Reply to author
Forward
0 new messages