Is there a way to get the message headers from RabbitMQ (different than the headers set through MassTransit)?
My use case is, I'm trying to read the timestamp added by RabbitMQ, timestamp_in_ms
(previously generated by RabbitMQ plugin, now native via configuration).
I've checked the docs and debugged, but couldn't find any RabbitMQ header key in what I receive.
I'm aware MassTransit adds its own "SentTime" on the message envelope, but I believe this is different than the timestamp
as filled in by RabbitMQ itself (with server local time of the broker).
Within a consumer, you can use:
var ts = context.ReceiveContext.GetSentTime();
if(ts.HasValue)
{
// do something with it?
}
That should get the Timestamp from the BasicProperties
if present.
Otherwise you can try using context.ReceiveContext.TransportHeaders
.