[rabbitmq-discuss] how to send a message including a array via .net client?

Chen Houwu chenhouwu at gmail.com
Mon Dec 27 12:49:40 GMT 2010


   I am a newbie to rabbitmq, I want to send a message object as
following via .net client:

   public class Message
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public byte[] Binary { get; set; }
        public string[] Infos{get;set;}
        public Dictionary<string,int> CountMap { get; set; }
    }

Here is my code:
-------------------------------------------
var builder = new
RabbitMQ.Client.Content.StreamMessageBuilder(_channel);
builder.writeObject(msg.ID);
builder.writeObject(msg.Name);
/*----------How to deal with msg.Infos and CountMap here?------------/

/*shoud it be written by myself such as: */
builder.writeObject(infos.count)
foreach(var info in infos)
{
   builder.writerObject(info)
}
/* or the suporting to array and dictionary already exists?*/

/* I have found in"src/client/impl/WireFormatting.cs", there are
methods like "WriteArray", and "WriteTable"*/

 IBasicProperties props = _channel.CreateBasicProperties();
props.DeliveryMode = 2;
 _channel.BasicPublish(_exchangeName, "some key", props,
builder.GetContentBody());
-----------------


More information about the rabbitmq-discuss mailing list