[rabbitmq-discuss] Decoding header fields

Bernhard Mogens Ege bme at saseco.dk
Thu Jul 26 10:12:49 BST 2012


When I receive messages, I also receive information in custom header fields.

 

I can see the fields are there by inspecting 

 

e.BasicProperties.Headers

 

where e is of the type BasicDeliverEventArgs

 

The keys I can iterate through and make direct lookups against, but the
values are returned as objects but are in reality Byte[].

 

If I know the key is a string, I can decode it with:

 

String example =
System.Text.Encoding.UTF8.GetString((byte[])e.BasicProperties.Headers["keyna
me"]);

 

But how do I decode integers, doubles and more?

 

Does RabbitMQ have something to aid me here?

 

Shouldn't RabbitMQ also pass the type with the value?

 

-- 

Bernhard

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120726/51582c88/attachment.htm>


More information about the rabbitmq-discuss mailing list