Erlang Mailing Lists

Author Message

<  RabbitMQ mailing list  ~  pub-sub part 2: erlang consume

Guest
Posted: Wed Apr 09, 2008 11:18 pm Reply with quote
Guest
I have published the message asynchronously to the exchange.
alexis
Posted: Thu Apr 10, 2008 9:13 am Reply with quote
User Joined: 06 Sep 2007 Posts: 80 Location: London
Joe

On Thu, Apr 10, 2008 at 12:17 AM, Joe Lee <codewalkerjoe@gmail.com> wrote:
> I have published the message asynchronously to the exchange. Now to consume
> the messages from the exchange, I can use either BasicGet or BasicConsume.
> When you are consuming messages in pub/sub model, do you have to specify
> what exchange to look for?

The consumer's messages are buffered by a queue Q which you must
explicitly bind, once, to a named exchange E. As you are doing
pub/sub, then E needs to be a Topic exchange. Q will bind to that
exchange with an associative pattern P (tuple of wildcards and routing
keys). Then, E will route messages to Q when their routing keys match
the pattern P. For example "buy.ibm" matches "*.ibm".


> In addition, when you consume message from an
> exchange regardless of messaging model(pub/sub), you still have to declare a
> queue, bind it and consume the message from the queue?

You can consume directly from an exchange. So, yes, you must declare
at least one queue per consumer, bind it to at least one exchange, and
consume messages from the queue. The queue is in effect 'subscribed'
to whichever topics match the binding pattern.

alexis

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post recived from mailinglist
View user's profile Send private message Yahoo Messenger
alexis
Posted: Thu Apr 10, 2008 9:34 am Reply with quote
User Joined: 06 Sep 2007 Posts: 80 Location: London
Joe

CORRECTION

I meant to type 'cannot'! Ahem...

On Thu, Apr 10, 2008 at 10:12 AM, Alexis Richardson
<alexis.richardson@cohesiveft.com> wrote:
>
> You CANNOT consume directly from an exchange.
> So, yes, you must declare
> at least one queue per consumer, bind it to at least one exchange, and
> consume messages from the queue. The queue is in effect 'subscribed'
> to whichever topics match the binding pattern.

alexis



--
Alexis Richardson
+44 20 7617 7339 (UK)
+44 77 9865 2911 (cell)
+1 650 206 2517 (US)

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post recived from mailinglist
View user's profile Send private message Yahoo Messenger
0x6e6562
Posted: Thu Apr 10, 2008 10:51 am Reply with quote
User Joined: 12 Jul 2007 Posts: 250
Hi Joe,

On 10 Apr 2008, at 00:17, Joe Lee wrote:
> BasicConsume and BasicGet there is a variable named queue = Q. In
> pub-sub case, how do you define null queue in Erlang-client? In
> basic.consume I set the queue = <<"">> like below:

Do you have a particular reason to declare a null queue?

Maybe you can tell us what you are trying to achieve.

HTH,

Ben

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post recived from mailinglist
View user's profile Send private message
Guest
Posted: Fri Apr 11, 2008 9:24 am Reply with quote
Guest
Hello all,

On Thu, Apr 10, 2008 at 6:55 AM, Ben Hood <0x6e6562@gmail.com (0x6e6562@gmail.com)> wrote:
Quote:
You are trying to match this tuple

#'queue.declare_ok'{queue = Q,
0x6e6562
Posted: Fri Apr 11, 2008 9:27 am Reply with quote
User Joined: 12 Jul 2007 Posts: 250
Joe,

On 11 Apr 2008, at 05:24, Joe Lee wrote:

> Also, I captured the packet with Wireshark and getting
> [Unreassembled Packet [incorrect TCP checksum]] and [Dissector bug,
> protocol AMQP: packet-amqp.c:1252. My guess is that rabbitmq is
> communicating with amqp-0.8 protocol and Wireshark trying to make
> sense out of those packets using amqp-0.9 protocol.

It may be worth your while looking at the code for the test suite that
is bundled with the client.

Look inside the test_util module.

To run the test within the same VM as the Erlang broker, run
direct_client_test:test().

These tests execute the entire lifecycle of the AMQP interaction with
the broker, so it will show you how the protocol looks like from a
client's perspective when you are programming in Erlang.

HTH,

Ben

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post recived from mailinglist
View user's profile Send private message
0x6e6562
Posted: Fri Apr 11, 2008 10:24 am Reply with quote
User Joined: 12 Jul 2007 Posts: 250
Joe,
On 10 Apr 2008, at 21:18, Joe Lee wrote:
Quote:
Does null queue have any special functionality?





Not really. As you correctly observe below, the expected behaviour of passing an empty queue name is that the broker fills this in for you and tells you what name it gave the queue. This is also the behaviour of RabbitMQ.

Quote:

Abstract from the amqp docs:

2.1.5.3 Constructing a PubSub
Subscription Queue

Here is the pseudocode
for creating and binding the pubsub subscription queue:
Queue.Declare
View user's profile Send private message
0x6e6562
Posted: Fri Apr 11, 2008 10:38 am Reply with quote
User Joined: 12 Jul 2007 Posts: 250
Message that didn't get posted to the list yesterday:

Begin forwarded message:
Quote:
From: Ben Hood <0x6e6562@gmail.com (0x6e6562@gmail.com)>
Date: 10 April 2008 11:55:49 BST
To: Joe Lee <codewalkerjoe@gmail.com (codewalkerjoe@gmail.com)>
Subject: Re: [rabbitmq-discuss] pub-sub part 2: erlang consume



Joe,

On 10 Apr 2008, at 00:17, Joe Lee wrote:
Quote:
(rabbit@home)5> amqp_async_consume:amqp_lifecycle_consume().
Quote:
Connection: {<0.178.0>,direct}
Quote:
** exception exit: {{amqp_async_consume,amqp_lifecycle_consume,0},
Quote:
View user's profile Send private message
0x6e6562
Posted: Fri Apr 11, 2008 10:40 am Reply with quote
User Joined: 12 Jul 2007 Posts: 250
On 11 Apr 2008, at 05:24, Joe Lee wrote:
Quote:
Hello all,

On Thu, Apr 10, 2008 at 6:55 AM, Ben Hood <0x6e6562@gmail.com (0x6e6562@gmail.com)> wrote:
Quote:
You are trying to match this tuple

#'queue.declare_ok'{queue = Q,
View user's profile Send private message
Guest
Posted: Fri Apr 11, 2008 11:31 am Reply with quote
Guest
On Thu, Apr 10, 2008 at 6:50 AM, Ben Hood <0x6e6562@gmail.com (0x6e6562@gmail.com)> wrote:
Quote:
Hi Joe,

On 10 Apr 2008, at 00:17, Joe Lee wrote:
> BasicConsume and BasicGet there is a variable named queue = Q. In
> pub-sub case, how do you define null queue in Erlang-client? In
> basic.consume I set the queue = <<"">> like below:


Do you have a particular reason to declare a null queue?

Taken straight from amqp0.8.pdf file pg25.

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum