[rabbitmq-discuss] subscriptions after .NET upgrade

Isaac Cambron icambron at gmail.com
Fri Nov 12 00:23:12 GMT 2010


Thanks Emile - I'll try that.

On Thu, Nov 11, 2010 at 4:30 AM, Emile Joubert <emile at rabbitmq.com> wrote:

> Hi Isaac,
>
> On 11/11/10 09:04, Isaac Cambron wrote:
> > I have an older application that I'm trying to get onto the latest and
> > greatest version of Rabbit and the .NET client. I'm having a bit of a
> > problem getting it to work the same way across the API changes.
> >
> > In my old app, I had a simple piece that broadcast to all of my
> > consumers who happen to be listening. Let's say they print the message's
> > content to the console when they get it. It was pretty simple. Each
> > consumer just creates a subscription:
> >
> > Subscription sub = new Subscription(ch, someExchange,
> > ExchangeType.Topic, someTopic);
> >
> > and listened to it. The broadcaster just did this:
> >
> > ch.BasicPublish(someExchange, someTopic, null, someBytes);
> >
> > Now, that signature for Subscription no longer exists. I've tried stuff
> > like this (which matches the old implementation from Subscription.cs):
> >
> > ch.ExchangeDeclare(EXCHANGE, ExchangeType.Topic);
> > ch.QueueDeclare(STATUS_QUEUE);
> > ch.QueueBind(STATUS_QUEUE, EXCHANGE, TOPIC, false, null);
> > Subscription sub = new Subscription(ch, STATUS_QUEUE, true);
> >
> > But the behavior I'm seeing is totally different:
> >
> > 1. Only one of the consumers gets the message and prints something. It's
> > round-robin instead of broadcast.
> > 2. When a new consumer is created and subscribes, it gets all of the
> > messages I've ever put in the queue and prints them to the console.
> >
> > I'm able to fix #2 by changing noAck to true, but not #1, and I suspect
> > I have something very wrong. Any ideas?
>
> Subscriptions have indeed been simplified for release version 2.0.0.
> Preceding the use of Subscription with declarations and the binding, as
> you have done, is correct.
>
> If only one consumer gets messages then try setting the channel prefetch
> to a small number (e.g. 1) by calling ch.BasicQos() before creating the
> subscription.
>
> Regards
>
>
> Emile
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20101111/3d40cd35/attachment.htm>


More information about the rabbitmq-discuss mailing list