I was previously using version 5 of the .NET client api for Rabbit. I would send me messages with custom header by using code similar to this:
IBasicProperties messageProperties = null;
lock (connectLock)
{
messageProperties = this._channel.CreateBasicProperties();
}
messageProperties.Headers = new Dictionary<string, object>(5);
then I would do a BasicPublish, passing the messageProperties object and message body.
my consumer received event would then retrieve the headers from the basic delivery event args i.e.
void consumer_Received(object sender, BasicDeliverEventArgs e)
{
var headers = e.BasicProperties.Headers;
However, after I upgraded to the 6.1 library....the Headers object is always NULL.
is there now a different way to retrieve headers using the 6.1 library?
Thereis a boolean property IsHeadersPresent which you should possibly check before attempting to access the Headers Collection.
I have a similar problem except I want to add a new Header, I don't really want to have to initialise the Headers Collection myself...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With