I need to verify that a message was sent by a specific user.
In order to achieve this, the UserId Property can be used in RabbitMq.
Currently, this works by sending a message in Rebus and including the RabbitMqHeaders.UserId header.
However, when receiving a message, the UserId Property is not preserved in the TransportMessage as it a Property of IBasicProperties and not one of the headers. Thus the UserId is lost to the receiver.
Am I missing something?
It seems to be a very simple fix by simply adding the following to CreateTransportMessage in RabbitMqTransport:
if (basicProperties.IsUserIdPresent())
headers[RabbitMqHeaders.UserId] = basicProperties.UserId;
There is a whole range of useful RabbitMq Properties in the IBasicProperties instance, so other properties might be useful to add as well.
I need to verify that a message was sent by a specific user. In order to achieve this, the UserId Property can be used in RabbitMq. Currently, this works by sending a message in Rebus and including the
RabbitMqHeaders.UserId
header.However, when receiving a message, the UserId Property is not preserved in the TransportMessage as it a Property of IBasicProperties and not one of the headers. Thus the UserId is lost to the receiver.
Am I missing something?
It seems to be a very simple fix by simply adding the following to
CreateTransportMessage
inRabbitMqTransport
:There is a whole range of useful RabbitMq Properties in the IBasicProperties instance, so other properties might be useful to add as well.