<div dir="ltr"><div>The queueDeclare() method (with no arguments) creates an exclusive auto-delete queue, so as soon as you do the channel.close() the queue will get deleted. You might want to look at using one of the other queueDeclare() methods to create a non-auto-delete queue.<br>
<br></div>Brett<br><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 12, 2013 at 4:44 PM, k.madnani84 <span dir="ltr">&lt;<a href="mailto:k.madnani84@gmail.com" target="_blank">k.madnani84@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I am using a java client in order to create a new exchange and a new queue<br>
and to bind them and publish message on the exchange.The Exchange is of type<br>
fan out so that whatever messages i publish to it should go to all the<br>
queues bound to it.The queues are automatically generated with the API<br>
queueDeclare.After running the below program i could see the exchange<br>
getting created but no queues are bound it.I couldnt see my newly created<br>
queue in the queue list.<br>
I ran &quot;rabbitmqctl list_bindings&quot; but couldnt find any entry for it.Could<br>
anybody help on it?<br>
<br>
Java Code:<br>
private static final String EXCHANGE_NAME = &quot;logs5&quot;;<br>
ConnectionFactory factory = new ConnectionFactory();<br>
                factory.setHost(&quot;localhost&quot;);<br>
                factory.setPort(5691);<br>
                factory.setUsername(&quot;rbtadmin&quot;);<br>
                factory.setPassword(&quot;x5b:LszV&quot;);<br>
<br>
                try {<br>
                        Connection connection = factory.newConnection();<br>
                        Channel channel = connection.createChannel();<br>
<br>
                        channel.exchangeDeclare(EXCHANGE_NAME, &quot;fanout&quot;);<br>
<br>
                        String queueName=channel.queueDeclare().getQueue();<br>
                        System.out.println(&quot;Queue Generated &quot; + queueName);<br>
                        BindOk isBindOk=channel.queueBind(queueName, &quot;logs5&quot;, &quot;&quot;);<br>
<br>
                        System.out.println(&quot; Queue Bind&#39;&quot; + isBindOk.toString());<br>
<br>
                        String message = &quot;Hello World !!!&quot;;<br>
<br>
                        channel.basicPublish(EXCHANGE_NAME, &quot;&quot;, null, message.getBytes());<br>
                    System.out.println(&quot; [x] Sent &#39;&quot; + message + &quot;&#39;&quot;);<br>
<br>
                    channel.close();<br>
                    connection.close();<br>
                } catch (IOException e) {<br>
<br>
                        e.printStackTrace();<br>
                }<br>
<br>
Output:<br>
Queue Generated amq.gen-E-JlumgQ_lbzAo7tlojrog<br>
 Queue Bind&#39;#method&lt;queue.bind-ok&gt;()<br>
 [x] Sent &#39;Hello World !!!&#39;<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://rabbitmq.1065348.n5.nabble.com/RabbitMQ-New-Queues-are-not-getting-binded-to-the-newly-created-exchange-tp28718.html" target="_blank">http://rabbitmq.1065348.n5.nabble.com/RabbitMQ-New-Queues-are-not-getting-binded-to-the-newly-created-exchange-tp28718.html</a><br>

Sent from the RabbitMQ mailing list archive at Nabble.com.<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>
</blockquote></div><br></div>