Andrey Grachev
Andrey Grachev

Reputation: 1357

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.

Upvotes: 1

Views: 621

Answers (1)

Vanlightly
Vanlightly

Reputation: 1479

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.

Upvotes: 3

Related Questions