<div dir="ltr">Is the routing key used when publishing the same as the binding key?</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Nov 4, 2013 at 7:22 AM, Murugesan Guruswamy <span dir="ltr">&lt;<a href="mailto:murugesan@elementum.com" target="_blank">murugesan@elementum.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I am trying to experiment exchanges and publishing it to an exchange using following code:</div>
<div><p style="margin-bottom:0px;font-size:11px;line-height:normal;font-family:Monaco"><span style="white-space:pre-wrap">                </span>Connection conn = <span style="color:#0326cc">factory</span>.newConnection(<span style="color:#0326cc">addr</span>);</p>

<p style="margin-bottom:0px;font-size:11px;line-height:normal;font-family:Monaco"><span style="white-space:pre-wrap">                </span>Channel channel = conn.createChannel();</p>
<p style="margin-bottom:0px;font-size:11px;line-height:normal;font-family:Monaco"><span style="white-space:pre-wrap">                </span>channel.exchangeDeclare(<span style="color:#0326cc">exchangeName</span>, <span style="color:#0326cc">topicName</span>, <span style="color:#931a68">true</span>); <span style="color:#4e9072">// durable. topic is &quot;direct&quot; and &quot;topic&quot; and have tried both</span></p>
<p style="margin-bottom:0px;font-size:11px;line-height:normal;font-family:Monaco"><span style="color:#4e9072">� � � � � � � ��</span>channel.basicPublish(<span style="color:rgb(3,38,204)">exchangeName</span>, routingKey, <span style="color:rgb(147,26,104)">null</span>, msg.getBytes());</p>
<p style="margin-bottom:0px;font-size:11px;line-height:normal;font-family:Monaco"><br></p><p style="margin-bottom:0px;font-size:11px;line-height:normal;font-family:Monaco">consumer code: (Tried both Queueing Consumer and my own Consumer imll).</p>
<p style="margin-bottom:0px;font-size:11px;line-height:normal;font-family:Monaco"></p><p style="margin-bottom:0px;font-size:11px;line-height:normal"><span style="white-space:pre-wrap">                </span>Channel channel = <span style="color:#0326cc">conn</span>.createChannel();<span style="white-space:pre-wrap">                </span></p>

<p style="margin-bottom:0px;font-size:11px;line-height:normal"><span style="white-space:pre-wrap">                </span>channel.exchangeDeclare(<span style="color:#0326cc">exchangeName</span>, <font color="#3933ff">topicName</font>, <span style="color:#931a68">true</span>);</p>

<p style="margin-bottom:0px;font-size:11px;line-height:normal;min-height:15px"><span style="white-space:pre-wrap">                </span>c<span style="color:rgb(78,144,114)">hannel.queueDeclare(</span><span style="color:rgb(3,38,204)">queueName</span><span style="color:rgb(78,144,114)">, </span><span style="color:rgb(147,26,104)">true</span><span style="color:rgb(78,144,114)">, </span><span style="color:rgb(147,26,104)">false</span><span style="color:rgb(78,144,114)">, </span><span style="color:rgb(147,26,104)">false</span><span style="color:rgb(78,144,114)">, </span><span style="color:rgb(147,26,104)">null</span><span style="color:rgb(78,144,114)">);</span></p>

<p style="margin-bottom:0px;font-size:11px;line-height:normal"><span style="white-space:pre-wrap">                </span>channel.queueBind(<span style="color:#0326cc">queueName</span>, <span style="color:#0326cc">exchangeName</span>, routingKey);</p>

<p style="margin-bottom:0px;font-size:11px;line-height:normal;color:rgb(78,144,114)"><span style="white-space:pre-wrap">                </span>QueueingConsumer qCon = <span style="color:rgb(147,26,104)">new</span> QueueingConsumer(channel);<br>
</p>
<p style="margin-bottom:0px;font-size:11px;line-height:normal;min-height:15px"><span style="white-space:pre-wrap">                </span></p>
<p style="margin-bottom:0px;font-size:11px;line-height:normal"><span style="white-space:pre-wrap">                </span>channel.basicConsume(<span style="color:#0326cc">queueName</span>, <span style="color:#931a68">false</span>, qCon);</p>

<p style="margin-bottom:0px;font-size:11px;line-height:normal;color:rgb(78,144,114)"><span style="color:rgb(0,0,0)"><span style="white-space:pre-wrap">                </span></span><span style="color:rgb(147,26,104)">while</span><span style="color:rgb(0,0,0)"> (</span><span style="color:rgb(147,26,104)">true</span><span style="color:rgb(0,0,0)">) {</span><br>
</p>
<p style="margin-bottom:0px;font-size:11px;line-height:normal"><span style="white-space:pre-wrap">                        </span>Delivery delivery = qCon.nextDelivery();</p>
<p style="margin-bottom:0px;font-size:11px;line-height:normal"><span style="white-space:pre-wrap">                        </span>System.<span style="color:#0326cc">out</span>.println(<span style="color:#3933ff">&quot;[x] &quot;</span> + <span style="color:#931a68">new</span> String(delivery.getBody()) + <span style="color:#3933ff">&quot; &quot;</span> + delivery.getEnvelope().getRoutingKey());</p>

<p style="margin-bottom:0px;font-size:11px;line-height:normal;min-height:15px"><span style="white-space:pre-wrap">                        </span></p>
<p style="margin-bottom:0px;font-size:11px;line-height:normal"><span style="white-space:pre-wrap">                        </span>qCon.getChannel().basicAck(delivery.getEnvelope().getDeliveryTag(), <span style="color:#931a68">false</span>);</p>

<p style="margin-bottom:0px;font-size:11px;line-height:normal"><span style="white-space:pre-wrap">                </span>}</p><div><br></div><div>Routing key : &quot;test.abc&quot;, queueName : Notification, exchangeName : localExchange.</div>
<div><br></div><div>Is there any rabbitmq-server configurations to do?</div><div><br></div><div>Please help here.</div><div><br></div><div>Thanks,</div><div>Murugesan</div><p></p></div><div><br></div><div><span style="color:#4e9072"><br>
</span></div></div>
<br>


<p><span style="font-size:10.5pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">Legal Disclaimer: The information
contained in this message may be privileged and confidential. It is intended to
be read only by the individual or entity to whom it is addressed or by their
designee. If the reader of this message is not the intended recipient, you are
on notice that any distribution of this message, in any form, is strictly prohibited.
If you have received this message in error, please immediately notify the
sender and delete or destroy any copy of this message </span></p>

<br>_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
<br></blockquote></div><br></div>