[rabbitmq-discuss] RE : RE : test of a existing queue

Cyril LECLERC Cyril.LECLERC at pragmaconsult.lu
Sat Feb 23 08:28:58 GMT 2013


excuse me i'm french i don't want to say it is a shame i want say it is not coooooollllll !!!my traduction is not very good sometimes... ;)
________________________________
De : Cyril LECLERC
Date d'envoi : vendredi 22 février 2013 20:20
À : Discussions about RabbitMQ
Objet : RE : [rabbitmq-discuss] RE : test of a existing queue

We could, perhaps add a convenience method to RabbitAdmin (boolean queueExists(String queueName)).

it is an great idea  but for a better configuration maybe not in rabbitAdmin, why? for example i don't want my application have a admin right on rabbitmq, moreoever i don't use the rabbit:admin tag because i don't need it, on AmpqTemplate object it is more usefull but it is a good idea!!!!

1° The queue specified on the <rabbit:template/> is ONLY used for the receive() methods - it is the default queue used if no queue is specified via the receive API.

ahhhhhh ok  bugt why it is a shame!!!!



2 ° Like I said, you don't SEND to a queue, you send to an exchange.


yes but not exactly....(exchange or routing key if you are in case queue connected to exchange by default).So how i can declare a exchange using spring in the code? because correct me if i do a mistake but it is an exchange or a "routing key" otherwise why it is working if y put my queue name? (direct exhange...)

I don't want at all any configuration in the code beacause all my variables in spring are externalized in a conf file!!!!

do you know how many device i can connect on rabbit mq maximum (consumers, iphone, android, jar....) with a good server ??? i'm sorry i've search lot of solutions befor contact you.. i wonder about the rapidity of yours responses....

Thank you very much


________________________________
De : rabbitmq-discuss-bounces at lists.rabbitmq.com [rabbitmq-discuss-bounces at lists.rabbitmq.com] de la part de Gary Russell [grussell at vmware.com]
Date d'envoi : vendredi 22 février 2013 18:58
À : Discussions about RabbitMQ
Objet : Re: [rabbitmq-discuss] RE : test of a existing queue

We could, perhaps add a convenience method to RabbitAdmin (boolean queueExists(String queueName)).

Feel free to open a New Feature issue: https://jira.springsource.org/browse/AMQP

The queue specified on the <rabbit:template/> is ONLY used for the receive() methods - it is the default queue used if no queue is specified via the receive API.

Like I said, you don't SEND to a queue, you send to an exchange.

________________________________
From: "Cyril LECLERC" <Cyril.LECLERC at pragmaconsult.lu>
To: "Discussions about RabbitMQ" <rabbitmq-discuss at lists.rabbitmq.com>
Sent: Friday, February 22, 2013 12:00:09 PM
Subject: [rabbitmq-discuss] RE :  test of a existing queue

thank you for your reactivity

channel.queueDeclarePassive(queueName) will throw an exception if the queue doesn't exist.

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) :

    @Inject
    AmqpTemplate amqpTemplate;
    amqpTemplate.convertAndSend("queue", messageField.getValue().toString());

my spring configuration :

<!-- now we can use -->
    <context:property-placeholder location="${ext.properties.dir}" />

    <rabbit:connection-factory id="rabbitConnectionFactory"
        host="${config.amqp.server}" username="${config.amqp.username}" password="${config.amqp.password}" />

    <!-- Creates a org.springframework.amqp.rabbit.core.RabbitTemplate for access
        to the broker -->
    <rabbit:template id="amqpTemplate" connection-factory="rabbitConnectionFactory" />

    <!-- Creates a queue for consumers to retrieve messages -->
    <rabbit:queue id="queue" name="${config.amqp.queuename}" />

    <bean id="messageListener" class="lu.pragmaconsult.geocamp.receiver.MessageHandler" />

    <rabbit:listener-container
        connection-factory="rabbitConnectionFactory" concurrency="${config.amqp.nbconsumer}"
        auto-startup="true">
        <rabbit:listener queues="queue" ref="messageListener" />
    </rabbit:listener-container>


If i use your advice :

    @Inject
    AmqpTemplate amqpTemplate;

    Channel channel;
    @Inject
    ConnectionFactory rabbitConnectionFactory;

    amqpTemplate.convertAndSend("queue", messageField.getValue().toString());


channel =(Channel) rabbitConnectionFactory.createConnection().createChannel(true);

                try {
                    channel.queueDeclarePassive("queue/GeoCampQueue3");
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

                //maybe add the code for verify the queue
                amqpTemplate.convertAndSend("queue/GeoCampQueue3", messageField.getValue().toString());


it is not what i want moreover i want the name of queue come from spring and not in code.


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.

if the queue is binding to the exchange by default, it is in direct so the queue name is my "routing key", if i put the name of the exchange ("") nothing happening

i try this :

    <rabbit:template id="amqpTemplate" connection-factory="rabbitConnectionFactory" queue="queue" exchange="" routing-key=""/>

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.....

have you got any idéas????

________________________________________
De : rabbitmq-discuss-bounces at lists.rabbitmq.com [rabbitmq-discuss-bounces at lists.rabbitmq.com] de la part de Gary Russell [grussell at vmware.com]
Date d'envoi : vendredi 22 février 2013 17:22
À : Discussions about RabbitMQ
Objet : Re: [rabbitmq-discuss] test of a existing queue

channel.queueDeclarePassive(queueName) will throw an exception if the queue doesn't exist.

You can get a channel by

Channel channel = factory.createConnection().createChannel(false);

where factory is a reference to the CachingConnectionFactory.

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.

----- Original Message -----
From: "Cyril LECLERC" <Cyril.LECLERC at pragmaconsult.lu>
To: "Discussions about RabbitMQ" <rabbitmq-discuss at lists.rabbitmq.com>
Sent: Friday, February 22, 2013 10:54:53 AM
Subject: [rabbitmq-discuss] test of a existing queue

Hello,

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.

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 ...

thanks....

Cyril
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

--
This email was Virus checked by Pragma Consult Security Gateway.

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss


--
This email was Virus checked by Pragma Consult Security Gateway.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130223/7751ba2a/attachment.htm>


More information about the rabbitmq-discuss mailing list