<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">thank you for your reactivity<br>
<br>
<b><i><u>channel.queueDeclarePassive(queueName) will throw an exception if the queue doesn't exist.</u></i></b><br>
<br>
Yes but the solution needs to use a Channel object, use @Inject of the factory, and it is not a boolean method so utilisation of spring amqp has no avantage and more it closes the channel connection!!!!we have to declare az new channel because spring create
 one by default plus all my consumers...for the moment my code is like this (in a wicket appplication) :<br>
<br>
&nbsp;&nbsp;&nbsp; @Inject<br>
&nbsp;&nbsp;&nbsp; <b>AmqpTemplate amqpTemplate;<br>
&nbsp;&nbsp;&nbsp; amqpTemplate.convertAndSend(&quot;queue&quot;, messageField.getValue().toString());</b><br>
<br>
my spring configuration :<br>
<br>
&lt;!-- now we can use --&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;context:property-placeholder location=&quot;${ext.properties.dir}&quot; /&gt;<br>
<br>
<b>&nbsp;&nbsp;&nbsp; &lt;rabbit:connection-factory id=&quot;rabbitConnectionFactory&quot;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; host=&quot;${config.amqp.server}&quot; username=&quot;${config.amqp.username}&quot; password=&quot;${config.amqp.password}&quot; /&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;!-- Creates a org.springframework.amqp.rabbit.core.RabbitTemplate for access
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; to the broker --&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;rabbit:template id=&quot;amqpTemplate&quot; connection-factory=&quot;rabbitConnectionFactory&quot; /&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;!-- Creates a queue for consumers to retrieve messages --&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;rabbit:queue id=&quot;queue&quot; name=&quot;${config.amqp.queuename}&quot; /&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;bean id=&quot;messageListener&quot; class=&quot;lu.pragmaconsult.geocamp.receiver.MessageHandler&quot; /&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;rabbit:listener-container<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; connection-factory=&quot;rabbitConnectionFactory&quot; concurrency=&quot;${config.amqp.nbconsumer}&quot;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; auto-startup=&quot;true&quot;&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;rabbit:listener queues=&quot;queue&quot; ref=&quot;messageListener&quot; /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/rabbit:listener-container&gt;</b><br>
<br>
<br>
If i use your advice :<br>
<br>
&nbsp;&nbsp;&nbsp; @Inject<br>
&nbsp;&nbsp;&nbsp; <b>AmqpTemplate amqpTemplate;<br>
<br>
&nbsp;&nbsp;&nbsp; </b><b><font color="FF0000">Channel channel;<br>
<font color="FF0000">&nbsp;&nbsp;&nbsp; @Inject<br>
&nbsp;&nbsp;&nbsp; ConnectionFactory rabbitConnectionFactory;</font><br>
</font><br>
&nbsp;&nbsp;&nbsp; amqpTemplate.convertAndSend(&quot;queue&quot;, messageField.getValue().toString());</b><br>
<br>
<br>
<font color="FF0000"><b>channel =(Channel) rabbitConnectionFactory.createConnection().createChannel(true);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; try {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; channel.queueDeclarePassive(&quot;queue/GeoCampQueue3&quot;);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } catch (IOException e) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // TODO Auto-generated catch block<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; e.printStackTrace();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //maybe add the code for verify the queue&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; amqpTemplate.convertAndSend(&quot;queue/GeoCampQueue3&quot;, messageField.getValue().toString());</b></font><br>
<br>
<br>
it is not what i want moreover i want the name of queue come from spring and not in code.<br>
<br>
<br>
<b><i>No, you can't specify the queue name in the send methods - you don't send to a queue, you send to an exchange, and it routes it to the queue.</i></b><br>
<br>
if the queue is binding to the exchange by default, it is in direct so the queue name is my &quot;routing key&quot;, if i put the name of the exchange (&quot;&quot;) nothing happening<br>
<br>
i try this :<br>
<br>
<b>&nbsp;&nbsp;&nbsp; &lt;rabbit:template id=&quot;amqpTemplate&quot; connection-factory=&quot;rabbitConnectionFactory&quot; queue=&quot;queue&quot; exchange=&quot;&quot; routing-key=&quot;&quot;/&gt;</b><br>
<br>
but the exchange and routing key is like this by default, so my template don't send automatiqueliy to my queue directly by spring configuration.....<br>
<br>
have you got any id�as????<br>
&nbsp;<br>
________________________________________<br>
De : rabbitmq-discuss-bounces@lists.rabbitmq.com [rabbitmq-discuss-bounces@lists.rabbitmq.com] de la part de Gary Russell [grussell@vmware.com]<br>
Date d'envoi : vendredi 22 f�vrier 2013 17:22<br>
� : Discussions about RabbitMQ<br>
Objet : Re: [rabbitmq-discuss] test of a existing queue<br>
<br>
channel.queueDeclarePassive(queueName) will throw an exception if the queue doesn't exist.<br>
<br>
You can get a channel by<br>
<br>
Channel channel = factory.createConnection().createChannel(false);<br>
<br>
where factory is a reference to the CachingConnectionFactory.<br>
<br>
No, you can't specify the queue name in the send methods - you don't send to a queue, you send to an exchange, and it routes it to the queue.<br>
<br>
----- Original Message -----<br>
From: &quot;Cyril LECLERC&quot; &lt;Cyril.LECLERC@pragmaconsult.lu&gt;<br>
To: &quot;Discussions about RabbitMQ&quot; &lt;rabbitmq-discuss@lists.rabbitmq.com&gt;<br>
Sent: Friday, February 22, 2013 10:54:53 AM<br>
Subject: [rabbitmq-discuss] test of a existing queue<br>
<br>
Hello,<br>
<br>
How we can test if a queue exits in application? Without the queueDeclare because it is not what i want, indeed, if i use amqpTemplate.convertAndSend(), and the queue does'nt existing, nothing will happen, but i have to know if the queue configured is existing,
 but not create it...because we use spring amqp.<br>
<br>
Moreover how we can configure the name of the queue in this method (amqpTemplate.convertAndSend()) because it takes one string argument but when it is configured in spring i don't have to configure in the code i want to use spring configuration ...<br>
<br>
thanks....<br>
<br>
Cyril<br>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
rabbitmq-discuss@lists.rabbitmq.com<br>
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss<br>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
rabbitmq-discuss@lists.rabbitmq.com<br>
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss<br>
<br>
--<br>
This email was Virus checked by Pragma Consult Security Gateway.<br>
</div>
</body>
</html>