qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robbie Gemmell <robbie.gemm...@gmail.com>
Subject Re: Hard-coded destination parameters prevent creation of Producer and Consumer
Date Tue, 21 Aug 2012 21:32:29 GMT
On 21 August 2012 16:51, Roger <roger.lefebvre@pason.com> wrote:

> Trying to connect to pre-existing durable destinations on RabbitMQ. Using
> qpid 0.16.
> When trying to create a producer of consumer extending the Hello.java
> example, the server logs the following:
>
> {amqp_error,precondition_failed,
>             "cannot redeclare exchange 'myExchange' in vhost '/' with
> different type, durable, internal or autodelete value",
>             'exchange.declare'}
>
> The key entries in my property file are as follows:
>
> connectionfactory.qpidConnectionfactory =
> amqp://guest:guest@localhost/?brokerlist='tcp://localhost:5672'
> destination.queue =
>
> BURL:direct://myExchange//myQueue?autodelete='false'&durable='true'&internal='false'&routingkey='testRoute'
>
> I downloaded the source and found that
> BasicMessageProducer.declareDestination method makes a
> createExchangeDeclareBody call with hard-coded boolean values for the
> durability, autodelete, internal and nowait parameters. A similar approach
> exists in AMQSession_0_8.sendExchnageDeclare which is called when setting
> up
> a consumer.
>
> Why are these hard-coded when the destination contains some (durable,
> autodelete) of the required values?
> There is a comment following the code which states:
>
> // Note that the durable and internal arguments are ignored since passive
> is
> set to false
>
> This is inaccurate as passive is set to:
>
> destination.getExchangeName().toString().startsWith("amq.")
>

I imagine the comment would have been accurate at the time, but someone has
made the declares of amq.*  (which are in a reserved namespace in the AMQP
spec for mandatory exchanges etc) exchanges passive since then.

The properties you are setting in the Binding URL are intended (as per the
documentation Rajith linked in his mail) to control the properties of the
queue which may be declared as a result of using it (consumers do a
QueueDeclare when they are created by the 0-8/0-9/0-9-1 client path when
using BindingURLs), and not the exchanges.

What you are really hitting here is a historical tendancy of the Qpid JMS
client and its users to only use the default amq.topic and amq.direct for
queues and topics respectively when no inherant restriction to doing so
really exists, coupled with limitations of the BindingURL format [and its
implementation] that are probably part of the reasons a more expressive
syntax was added, albeit it only got implemented for the AMQP 0-10 client
path that is used by default against both the Qpid brokers now. Coming from
another 0-9-1 client/broker which has resulted in your use of custom
exchanges, you are unfortunatley much better placed to feel such pain.


>
> When I changed the code to use the destination values, it successfully
> created  the producer. I can now send messages.
> With respect to the consumer, the ExchangeDeclareBody was successfully
> created, but the system hangs on protocolHandler.syncWrite. Digging into
> that now.
>

The only usual reason for it to wait there is that it didn't get the reply
frame it was waiting for, posibly because something on the other end went
bang. Did you get any further digging into it?

>
> With respect to other hard coded booleans, I'm not familiar with the
> purpose
> of the nowait parameter yet, or its possible source, so I left it unchanged
> in my implementation. The internal boolean, seems to be associated with the
> exchanged name. Will familiarize myself and possibly update in future
> reply.
> It too was left as is.
>
> Any advice or insight on the issues I've resolved or am currently
> encountering would be appreciated.
>
> Thx,
> Roger
>
>
>
> --
> View this message in context:
> http://qpid.2158936.n2.nabble.com/Hard-coded-destination-parameters-prevent-creation-of-Producer-and-Consumer-tp7581160.html
> Sent from the Apache Qpid users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message