You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by ffrenchm <ff...@gmail.com> on 2009/03/11 17:47:57 UTC

Question about createQueue JMS method

Hello,

If I want to send message on non existing queue "Q1" without any consumer on
this queue, I notice that no queue "Q1" are created. I would like to know :

1) why queue are created when creating JMS consumer and not JMS producer ?
2) where are pushed the messages sended by my sender ? Is there a dead
letter queue in QPID ? Why do I not have an exception which tell me the
queue doesn't exist ? 

Thanks for all
-- 
View this message in context: http://n2.nabble.com/Question-about-createQueue-JMS-method-tp2462420p2462420.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Question about createQueue JMS method

Posted by Gordon Sim <gs...@redhat.com>.
Rajith Attapattu wrote:
> On Wed, Mar 11, 2009 at 12:47 PM, ffrenchm <ff...@gmail.com> wrote:
>> Hello,
>>
>> If I want to send message on non existing queue "Q1" without any consumer on
>> this queue, I notice that no queue "Q1" are created. I would like to know :
>>
>> 1) why queue are created when creating JMS consumer and not JMS producer ?
> The JMS producer does not create and bind any queues.

I think the question is, why?

I can understand that the producer for a Topic would ignore the 
declaration of queues or bindings while the corresponding consumer would 
create the queue and bind it.

For a Queue though I think the current behaviour is unintuitive. If the 
queue is created on demand when consuming from it, I would expect the 
same to happen when producing to it.

>> 2) where are pushed the messages sended by my sender ? Is there a dead
>> letter queue in QPID ? Why do I not have an exception which tell me the
>> queue doesn't exist ?

I think a much better and simpler solution here would be to declare the 
queue on creating a producer for the Queue instance, optionally setting 
the passive flag if we don't want auto-created queues. The same would 
work for creating a consumer for that Queue.

That way you can either have create-on-demand queues that work whether 
you happen to try to publish or consume first, or you can fail fast with 
an exception when you try to produce or consume to a non-existent queue 
in the event that you expect these to have been preconfigured.

To me that would be more intuitive.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Question about createQueue JMS method

Posted by Rajith Attapattu <ra...@gmail.com>.
On Wed, Mar 11, 2009 at 12:47 PM, ffrenchm <ff...@gmail.com> wrote:
>
> Hello,
>
> If I want to send message on non existing queue "Q1" without any consumer on
> this queue, I notice that no queue "Q1" are created. I would like to know :
>
> 1) why queue are created when creating JMS consumer and not JMS producer ?
The JMS producer does not create and bind any queues.

> 2) where are pushed the messages sended by my sender ? Is there a dead
> letter queue in QPID ? Why do I not have an exception which tell me the
> queue doesn't exist ?

As per the AMQP spec the following is the define behaviour.
If the immediate flag on the delivery properties is not set then the
message will be silently dropped.
If the immediate flag is set and there are no active consumers ready
to take the message then the message is considered unroutable.

The treatment of unroutable messages is dependent on the value of the
discard-unroutable flag
If this flag is set it will be discarded. If not set, an unroutable
message should be handled by reject (which will results in an
exception on the sender side) when accept-mode is explicit; or by
routing to the alternate-exchange if defined when accept-mode is none.

However a couple of things are not implemented yet.
The c++ broker does not implement the functionality for immediate or
discard-unroutable.
The JMS client has no way to set the discard-unroutable or immediate flags.

We intend to fix this behaviour and I will create JIRA's for these items.

Here is a reasonable workaround.
When you declare the exchange you could specify an alternative
exchange. Currently the c++ broker will try the alternative exchange
if the current exchange cannot route the message (before dropping the
message). In your alternative exchange you can setup a queue to
collect these unroutable messages (sort of like a DLQ).

You could use qpid-config to setup the alternative exchange.

Regards,

Rajith

> Thanks for all
> --
> View this message in context: http://n2.nabble.com/Question-about-createQueue-JMS-method-tp2462420p2462420.html
> Sent from the Apache Qpid users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
>



-- 
Regards,

Rajith Attapattu
Red Hat
http://rajith.2rlabs.com/

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org