rabbitmqmsmq

Message label in Rabbitmq


MSMQ messages have a Label property. It can contain an application-defined string describing the message. Does Rabbitmq have such a concept? Maybe it's called differently - haven't found anything similar yet.


Solution

  • I would use custom message headers. They are a lot more flexible than the MSMQ label. You can store string, number or boolean, or a list of those values.

    Add custom headers to the IBasicProperties (C# example)

    var properties = channel.CreateBasicProperties();
    properties.Headers = new Dictionary<string, object>();
    properties.Headers.Add("Label", "some text");
    

    When you consume, extract them from the IBasicProperties.