[rabbitmq-discuss] Exchange details are not set while creating with Put Method in c#
Lijo Sebastian
lijo at citrusinformatics.com
Tue Nov 26 10:12:17 GMT 2013
Simon,
Yes i do read the response.
The response says with StatusDescription Created.
Also i can see from management console that which exchanges are present and
not. So there is no chance of someone came and create any.
Regarding the coding, i may or may not be a non-c# expert, but this is the
basic format of creating a HttpWebRequest in c#.
I tried without specifying any of the type of exchange, it is still creating
the same fanout type.
Regards,
Lijo Sebastian
Senior Software Engineer
Citrus Informatics (India) Pvt Ltd.
-----Original Message-----
From: Simon MacMullen
Sent: Tuesday, November 26, 2013 3:15 PM
To: Discussions about RabbitMQ
Cc: Lijo Sebastian
Subject: Re: [rabbitmq-discuss] Exchange details are not set while creating
with Put Method in c#
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