[rabbitmq-discuss] Exchange details are not set while creating with Put Method in c#

Lijo Sebastian lijo at citrusinformatics.com
Tue Nov 26 06:48:52 GMT 2013


Hi, 
       I am trying to create an exchange of type Topic. 
    
        Using PUT method to rabbitmq server, i was able to create one,  but the type is always fanout.

Below is the code i used.

Please tell what i am wrong here?

Code: 


var httpWebRequest = (HttpWebRequest)WebRequest.Create("http://guest:guest@rabbitmqserver/endpoint/x/exchangeName");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "PUT";
var data= new Dictionary<string, string>();
data.Add("type", "topic");
data.Add("auto_delete", false.ToString().ToLower());
data.Add("durable", true.ToString().ToLower());

using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{

    string json = JsonConvert.SerializeObject(data);

    streamWriter.Write(json);
    streamWriter.Flush();
    streamWriter.Close();

    var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
    using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
    {
        var result = streamReader.ReadToEnd();
    }
}

Regards, 
Lijo Sebastian
Senior Software Engineer
Citrus Informatics (India) Pvt Ltd.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20131126/abfa09ff/attachment.htm>


More information about the rabbitmq-discuss mailing list