[rabbitmq-discuss] Issue with .Net client Subscription
Deepak.Kumar1 at rbs.com
Deepak.Kumar1 at rbs.com
Fri Sep 18 01:30:46 BST 2009
Hi Paul
Tried a few possible ways to create exchange and Bind2Q but didn't work so far, it seems to need some precise sequence which escapes me
here's the publishing code
string serverAndPort = "localhost:5672";
IConnection conn1 = new ConnectionFactory().CreateConnection( serverAndPort );
IModel ch = conn1.CreateModel();
string routingKey = "STOCK.PRICES"; //"STOCK.PRICES.#";
string qn = "myq", exch = "nasdaq";
ch.ExchangeDeclare(exch, ExchangeType.Direct);
string finalName = chSendUpdate.QueueDeclare(qn, false,
false, false, false,
false, null);
ch.QueueBind(finalName, exch, routingKey, false, null);
ch.BasicPublish(string.Empty, "STOCK.PRICES." + CUSIP, null, Encoding.UTF8.GetBytes(bodyText));
recv'ng code is
string routingKey = "STOCK.PRICES.#";
using (IConnection conn = new ConnectionFactory().CreateConnection("localhost:5672")){
using (IModel ch = conn.CreateModel()) {
Subscription sub = new Subscription(ch, "nasdaq", ExchangeType.Direct, routingKey);
foreach (BasicDeliverEventArgs e in sub){
Console.WriteLine("#2> Exch({0}) Topic({1}):{2}", e.Exchange, e.RoutingKey, ASCIIEncoding.ASCII.GetString(e.Body));
sub.Ack(e);
}
Console.WriteLine("Out of sub loop...<ENTER>");
Console.ReadLine();
}
}
Assuming it's my code and not something in the library, id' think that a magic combination/method call sequence is required in ch.QueueBind() to make it all work !
Thanks for your help
Deepak
________________________________
From: Paul Jones [mailto:pauljones23 at gmail.com]
Sent: Thursday, September 17, 2009 3:42 PM
To: Kumar, Deepak, GBM
Cc: rabbitmq-discuss at lists.rabbitmq.com
Subject: Re: [rabbitmq-discuss] Issue with .Net client Subscription
Hi Deepak,
Did you create a topic exchange? Wildcard routing keys in the form you're using require a topic exchange.
Paul.
On Thu, Sep 17, 2009 at 8:36 PM, <Deepak.Kumar1 at rbs.com<mailto:Deepak.Kumar1 at rbs.com>> wrote:
Hello
Has anyone faced issues not getting messages when using catch-all subscription using the .Net Client library ?
The publishing code is below -
IConnection conn1 = new ConnectionFactory().CreateConnection( "localhost:5672");
chSendUpdate = conn1.CreateModel();
...
chSendUpdate.BasicPublish(string.Empty, "STOCK.PRICES." + CUSIP, null, Encoding.UTF8.GetBytes(bodyText));
The subscription code is
using (IConnection conn = new ConnectionFactory().CreateConnection("localhost:5672")){
using (IModel ch = conn.CreateModel()) {
Subscription sub = new Subscription(ch, "STOCK.PRICES.#");
foreach (BasicDeliverEventArgs e in sub) {
Console.WriteLine("Topic({0}):{1}", e.RoutingKey, ASCIIEncoding.ASCII.GetString(e.Body));
sub.Ack(e);
}
}
}
}
If the subscription RoutingKey is changed to specific like "STOCK.PRICES.MSFT" etc. then the messages are received fine so i'm guessing there's some flag/option that needs to bet setup or enabled
I've also tried the sample code in the .net user guide using QueueingBasicConsumer
but no success there either
Any ideas on what could be wrong ?
*****Please note that my email address may have changed. For all
future correspondence, please use this address*****
********************************************************************This
message (including any attachments) is confidential and/or
privileged. It is to be used by the intended recipients only. If
you have received it by mistake please notify the sender by return
e-mail and delete this message from your system. Any unauthorized
use or dissemination of this message in whole or in part is
strictly prohibited. Please note that e-mails are inherently
insecure and susceptible to change. The Royal Bank of Scotland
Group, plc ("RBS") and its US subsidiaries, and affiliates and
subsidiary undertakings, including but not limited to, RBS plc New
York and Connecticut Branches, RBS Securities Inc., ABN AMRO Bank
N.V. New York and Chicago Branches and, ABN AMRO Incorporated,
Citizens Financial Group, Inc. and RBS Citizens, N.A., shall not be
liable for the improper or incomplete transmission of the
information contained in this communication or Attachment nor for
any delay in its receipt or damage to your system. RBS does not
guarantee that the integrity of this communication has been
maintained nor that this communication is free of viruses,
interceptions or interference. RBS and its subsidiaries and
affiliates do not guarantee the accuracy of any email or
attachment, that an email will be received or that RBS or its
affiliates and subsidiaries will respond to an email.
RBS makes no representations that any information contained in this
message (including any attachments) are appropriate for use in all
locations or that transactions, securities, products, instruments
or services discussed herein are available or appropriate for sale
or use in all jurisdictions, or by all investors or counterparties.
Those who utilize this information do so on their own initiative
and are responsible for compliance with applicable local laws or
regulations.********************************************************************
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com<mailto:rabbitmq-discuss at lists.rabbitmq.com>
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
*****Please note that my email address may have changed. For all
future correspondence, please use this address*****
********************************************************************This
message (including any attachments) is confidential and/or
privileged. It is to be used by the intended recipients only. If
you have received it by mistake please notify the sender by return
e-mail and delete this message from your system. Any unauthorized
use or dissemination of this message in whole or in part is
strictly prohibited. Please note that e-mails are inherently
insecure and susceptible to change. The Royal Bank of Scotland
Group, plc ("RBS") and its US subsidiaries, and affiliates and
subsidiary undertakings, including but not limited to, RBS plc New
York and Connecticut Branches, RBS Securities Inc., ABN AMRO Bank
N.V. New York and Chicago Branches and, ABN AMRO Incorporated,
Citizens Financial Group, Inc. and RBS Citizens, N.A., shall not be
liable for the improper or incomplete transmission of the
information contained in this communication or Attachment nor for
any delay in its receipt or damage to your system. RBS does not
guarantee that the integrity of this communication has been
maintained nor that this communication is free of viruses,
interceptions or interference. RBS and its subsidiaries and
affiliates do not guarantee the accuracy of any email or
attachment, that an email will be received or that RBS or its
affiliates and subsidiaries will respond to an email.
RBS makes no representations that any information contained in this
message (including any attachments) are appropriate for use in all
locations or that transactions, securities, products, instruments
or services discussed herein are available or appropriate for sale
or use in all jurisdictions, or by all investors or counterparties.
Those who utilize this information do so on their own initiative
and are responsible for compliance with applicable local laws or
regulations.********************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20090917/ceb56405/attachment.htm
More information about the rabbitmq-discuss
mailing list