<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Joe,<div><br></div><div>When you publish a message to an AMQP broker using the Basic Publish command you are sending an message&nbsp;asynchronously&nbsp;to an exchange.</div><div><br></div><div>In doing so, you need to provide a routing key that the broker uses to determine where to deliver the message to.</div><div><br></div><div>Hence channels don't directly send messages to a queue using the Publish command.</div><div><br></div><div>Therefore you can have multiple channels deliver to a single queue if the routing keys match to one particular bound queue.</div><div><br></div><div>HTH,</div><div><br></div><div>Ben</div><div><br><div><html>On 1 Apr 2008, at 15:43, Joe Lee wrote:</html><br class="Apple-interchange-newline"><blockquote type="cite">I did a quick search and educated myself bit on enterprise integration.&nbsp; It seems publish-subscribe model doesn't have any queue.&nbsp; Message published from the publisher first stored in publisher's memory and transfered to the channel on the background.&nbsp; Then the message get stored into memory of the consumer and the consumer consumes the message from its memory.<br> <br>I need something along the line of amazon sqs, asynchronous with queue.&nbsp; This maybe a silly question to someone who is into enterprise integration.&nbsp; If I go with synchronous message passing, can I have, for example, multiple different channels sending messages to a single queue?&nbsp; I just want to avoid channel being the bottleneck.<br> <br>thank you,<br>Joe<br><br><br><div class="gmail_quote">On Mon, Mar 31, 2008 at 5:33 PM, Ben Hood &lt;<a href="mailto:0x6e6562@gmail.com">0x6e6562@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div style="">Joe,<div><br><div><div class="Ih2E3d">On 31 Mar 2008, at 22:05, joe lee wrote:<br><blockquote type="cite">Anyone knows how to do a basic publish (asynchronous method, no syncing with broker) using erlang-client, either in amqp mode or erlang mode?<br> </blockquote><div><br></div></div><div>If I understand you correctly, if you want to publish a message, you can do the following:</div><div><br></div><div><div style="margin: 0px;"><span style="color: rgb(150, 100, 0);">BasicPublish</span> <span style="color: rgb(50, 50, 90);">=</span> <span style="color: rgb(50, 50, 90);">#</span>'basic.publish'<span style="color: rgb(50, 50, 90);">{</span>ticket <span style="color: rgb(50, 50, 90);">=</span> <span style="color: rgb(150, 100, 0);">Ticket</span><span style="color: rgb(50, 50, 90);">,</span> exchange <span style="color: rgb(50, 50, 90);">=</span> <span style="color: rgb(150, 100, 0);">X</span><span style="color: rgb(50, 50, 90);">,</span></div> <div style="margin: 0px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; routing_key <span style="color: rgb(50, 50, 90);">=</span> <span style="color: rgb(150, 100, 0);">RoutingKey</span><span style="color: rgb(50, 50, 90);">,</span></div> <div style="margin: 0px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mandatory <span style="color: rgb(50, 50, 90);">=</span> <span style="color: rgb(150, 100, 0);">Mandatory</span><span style="color: rgb(50, 50, 90);">,</span></div> <div style="margin: 0px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; immediate <span style="color: rgb(50, 50, 90);">=</span> <span style="color: rgb(150, 100, 0);">Immediate</span><span style="color: rgb(50, 50, 90);">},</span></div> <div style="margin: 0px;"><span style="color: rgb(150, 100, 0);">Content</span> <span style="color: rgb(50, 50, 90);">=</span> <span style="color: rgb(50, 50, 90);">#</span>content<span style="color: rgb(50, 50, 90);">{</span>class_id <span style="color: rgb(50, 50, 90);">=</span> <span style="color: rgb(90, 90, 180);">60</span><span style="color: rgb(50, 50, 90);">,</span></div> <div style="margin: 0px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; properties <span style="color: rgb(50, 50, 90);">=</span> amqp_util<span style="color: rgb(50, 50, 90);">:</span>basic_properties<span style="color: rgb(50, 50, 90);">(),</span> <span style="color: rgb(0, 115, 0);">%% either 'none', or a decoded record/tuple</span></div> <div style="margin: 0px; color: rgb(0, 115, 0);"><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; properties_bin </span><span style="color: rgb(50, 50, 90);">=</span><span style="color: rgb(0, 0, 0);"> 'none'</span><span style="color: rgb(50, 50, 90);">,</span><span style="color: rgb(0, 0, 0);"> </span>%% either 'none', or an encoded properties amqp_util:binary</div> <div style="margin: 0px; color: rgb(0, 115, 0);"><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span>%% Note: at most one of properties and properties_bin can be 'none' at once.</div><div style="margin: 0px; color: rgb(0, 115, 0);"> <span style="color: rgb(0, 0, 0);">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; payload_fragments_rev </span><span style="color: rgb(50, 50, 90);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(50, 50, 90);">[</span><span style="color: rgb(150, 100, 0);">Payload</span><span style="color: rgb(50, 50, 90);">]</span><span style="color: rgb(0, 0, 0);"> </span>%% list of binaries, in reverse order (!)</div> <div style="margin: 0px;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: rgb(50, 50, 90);">},</span></div><div style="margin: 0px; color: rgb(150, 100, 0);"><span style="color: rgb(0, 0, 0);">amqp_channel</span><span style="color: rgb(50, 50, 90);">:</span><span style="color: rgb(0, 0, 0);">cast</span><span style="color: rgb(50, 50, 90);">(</span>Channel<span style="color: rgb(50, 50, 90);">,</span><span style="color: rgb(0, 0, 0);"> </span>BasicPublish<span style="color: rgb(50, 50, 90);">,</span><span style="color: rgb(0, 0, 0);"> </span>Content<span style="color: rgb(50, 50, 90);">),</span></div> </div><div><br></div>This code is taken from the setup_publish/3 function in the test_util module of the Erlang client.</div><div><br></div><div>The cast/3 function in amqp_channel sends the message asynchronously irrespective of whether you are using the TCP variant or native Erlang messaging.</div> <div><br></div><div>BTW, what do you mean when you say "amqp mode or erlang mode"?</div><div class="Ih2E3d"><div><br><blockquote type="cite">I have a queue and need to send message to the queue asynchronously and consumer will come along and process it.&nbsp; If you are doing publish-subscribe, do you define a queue like you do for sysnchronous method? <br> </blockquote></div><br></div></div><div>I'm not quite sure I follow. Which synchronous method are you referring to?</div><div><br></div><div>HTH,</div><div><br></div><font color="#888888"><div>Ben</div></font></div><br> _______________________________________________<br> rabbitmq-discuss mailing list<br> <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br> <a href="http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br> <br></blockquote></div><br></blockquote></div><br></div></body></html>