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

Simon MacMullen simon at rabbitmq.com
Tue Nov 26 09:45:12 GMT 2013


If you don't specify the exchange type (somehow) then the default is 
direct, not fanout. And your code looks right as a non-C# expert. So I 
suspect that someone previously declared a fanout exchange with the same 
name. The server should be responding with 400 Bad Request and an error 
message - are you checking the response?

Cheers, Simon

On 26/11/2013 06:48, Lijo Sebastian wrote:
> 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.
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>



More information about the rabbitmq-discuss mailing list