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

Ben Hood 0x6e6562 at gmail.com
Tue Apr 1 17:08:50 BST 2008


Joe,

When you publish a message to an AMQP broker using the Basic Publish  
command you are sending an message asynchronously to an exchange.

In doing so, you need to provide a routing key that the broker uses to  
determine where to deliver the message to.

Hence channels don't directly send messages to a queue using the  
Publish command.

Therefore you can have multiple channels deliver to a single queue if  
the routing keys match to one particular bound queue.

HTH,

Ben

On 1 Apr 2008, at 15:43, Joe Lee wrote:

> I did a quick search and educated myself bit on enterprise  
> integration.  It seems publish-subscribe model doesn't have any  
> queue.  Message published from the publisher first stored in  
> publisher's memory and transfered to the channel on the background.   
> Then the message get stored into memory of the consumer and the  
> consumer consumes the message from its memory.
>
> I need something along the line of amazon sqs, asynchronous with  
> queue.  This maybe a silly question to someone who is into  
> enterprise integration.  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.
>
> thank you,
> Joe
>
>
> 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
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20080401/da672aec/attachment.htm 


More information about the rabbitmq-discuss mailing list