[rabbitmq-discuss] basic public-subscribe model with erlang-client

Alexis Richardson alexis.richardson at cohesiveft.com
Tue Apr 1 16:52:02 BST 2008


Joe

On Tue, Apr 1, 2008 at 7:43 AM, Joe Lee <codewalkerjoe at gmail.com> wrote:
> I did a quick search and educated myself bit on enterprise integration.  It
> seems publish-subscribe model doesn't have any queue.

In AMQP the end consumers receive messages via a buffer - called a
queue.  If you stream on a 'pub/sub' basis then exchanges route to
queues whose bindings are in effect 'subscriptions'.  The spec is more
informative on this point.


> Message published
> from the publisher first stored in publisher's memory and transfered to the
> channel on the background.

That describes a physical implementation.  AMQP describes a logical
architecture.  AMQP allows for the broker (exchange+queue) to be
colocated with the publisher in memory.  The consuming client may then
be connected to the broker over a network.  Modulo your notion of
channel (which may not be the same as 'channel' in AMQP) this then
describes the physical topology that you want.

> Then the message get stored into memory of the
> consumer and the consumer consumes the message from its memory.

This is ambiguous because you could have two cases:

- physical queue colocated with consuming client
- client has private buffer holding messages delivered from queue
located at broker elsewhere




> I need something along the line of amazon sqs, asynchronous with queue.

In SQS the sending client is on one machine, which connects to 'the
cloud' where the SQS queue is hosted.  The receiving client is then on
another machine not on the cloud.  In other words:

sender --> broker --> receiver

... are on three different machines.

RabbitMQ provides this set-up easily.  Try the RabbitMQ broker at
dev.rabbitmq.com



> This maybe a silly question to someone who is into enterprise integration.

Not silly at all.  RabbitMQ is not just about enterprise integration.
Many users are 'web20' style companies who are just sending messages
within a system that they wholly control, to achieve scale,
availability, and reliability.  I think that some of them use Amazon
EC2 to run RabbitMQ instances.


> If I go with synchronous message passing, can I have, for example, multiple
> different channels sending messages to a single queue?  I just want to avoid
> channel being the bottleneck.

I am not sure if you mean an AMQP channel.  Channel will not be a
bottleneck in RabbitMQ.  Create a queue and bind it to a direct
exchange with key "test-direct".  Then create some clients and send
messages with that key to the broker.  They will all route that single
queue, as you require.

alexis



>
> On Mon, Mar 31, 2008 at 5:33 PM, Ben Hood <0x6e6562 at gmail.com> wrote:
> >
> >
> >
> >
> > Joe,
> >
> >
> >
> > On 31 Mar 2008, at 22:05, joe lee wrote:
> >
> > Anyone knows how to do a basic publish (asynchronous method, no syncing
> with broker) using erlang-client, either in amqp mode or erlang mode?
> >
> >
> >
> > If I understand you correctly, if you want to publish a message, you can
> do the following:
> >
> >
> >
> > BasicPublish = #'basic.publish'{ticket = Ticket, exchange = X,
> >                                     routing_key = RoutingKey,
> >                                     mandatory = Mandatory,
> >                                     immediate = Immediate},
> > Content = #content{class_id = 60,
> >          properties = amqp_util:basic_properties(), %% either 'none', or a
> decoded record/tuple
> >          properties_bin = 'none', %% either 'none', or an encoded
> properties amqp_util:binary
> >          %% Note: at most one of properties and properties_bin can be
> 'none' at once.
> >          payload_fragments_rev = [Payload] %% list of binaries, in reverse
> order (!)
> >         },
> > amqp_channel:cast(Channel, BasicPublish, Content),
> >
> > This code is taken from the setup_publish/3 function in the test_util
> module of the Erlang client.
> >
> >
> > The cast/3 function in amqp_channel sends the message asynchronously
> irrespective of whether you are using the TCP variant or native Erlang
> messaging.
> >
> >
> > BTW, what do you mean when you say "amqp mode or erlang mode"?
> >
> >
> >
> > I have a queue and need to send message to the queue asynchronously and
> consumer will come along and process it.  If you are doing
> publish-subscribe, do you define a queue like you do for sysnchronous
> method?
> >
> >
> > I'm not quite sure I follow. Which synchronous method are you referring
> to?
> >
> >
> > HTH,
> >
> >
> > Ben
> > _______________________________________________
> > rabbitmq-discuss mailing list
> > rabbitmq-discuss at lists.rabbitmq.com
> > http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
> >
> >
>
>
> _______________________________________________
>  rabbitmq-discuss mailing list
>  rabbitmq-discuss at lists.rabbitmq.com
>  http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>



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




More information about the rabbitmq-discuss mailing list