You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Roger <ro...@pason.com> on 2012/08/21 17:51:51 UTC

Hard-coded destination parameters prevent creation of Producer and Consumer

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

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.

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


Re: Hard-coded destination parameters prevent creation of Producer and Consumer

Posted by Robbie Gemmell <ro...@gmail.com>.
Hi Roger,

I have now committed some changes to trunk for
https://issues.apache.org/jira/browse/QPID-4261 , adding some options
('exchangedurable', 'exchangeautodelete', and 'exchangeinternal') to the
BindingURLs which should hopefully now let you set the properties used in
the ExchangeDeclares to match the exchanges present on your RabbitMQ
broker. Could you try them out and let me know how you get on? I forced the
nightly trunk build job to run early so you can get a copy of the updated
client here now if you need:
https://builds.apache.org/view/M-R/view/Qpid/job/Qpid-Java-Artefact-Release/lastSuccessfulBuild/artifact/trunk/qpid/java/client/release/

I doubt the diff will apply automatically to 0.18 (now available via
http://qpid.apache.org/download.html ) due to interaction with the earlier
changes from QPID-4250 (which probably also wont apply automatically
either), but I expect the fixups required should be absolutely trivial. I'm
not sure how much conflict there will be if you try applying it to 0.16,
but we can work that out if need be.

Robbie

On 29 August 2012 00:00, Robbie Gemmell <ro...@gmail.com> wrote:

> On 27 August 2012 20:39, Roger <ro...@pason.com> wrote:
>
>> > If disabling the queue and exchange declares is
>> > an option for you (i.e you can rely on them being present already) then
>> > you
>> > should be able to use that change along with the system properties I
>> > mentioned to do so. If not, we can try to work out a suitable course to
>> > allow manipulating the exchange declare properties.
>>
>> We are running a mixed bag here. Some queues are predefined, while others
>> (actually system named topics) are temporary and defined on the fly.
>> Consequently, the proposed solution doesn't address all our use cases.
>> I find it odd that qpid.declare_exchanges is a global parameter as it
>> implies an all-or-none configuration approach.
>
>
> Ok. I only brought it up because I spotted them while looking into what
> you were seeing and wondered if it would work since you had mentioned using
> predefined destinations. The properties arent really documented or even
> intended for regular use I believe, but someone obviously had a use case at
> some point and added them.
>
>
>> Most, if not all, my
>> experience in messaging systems have always leveraged on-the-fly
>> queue/topic
>> creation.
>
>
> On-the-fly queue and topic creation is supported and indeed fairly usual,
> the problem is your custom exchanges are not something the Qpid JMS client
> handles well since it historically hasn't catered for that (mainly sticking
> to the pre-existing amq. exchanges) and has never saw much/any use of where
> 0-8/0-9/0-9-1 + BindingURLs are concerned. The newer 'Address' syntax
> supported by the AMQP 0-10 path of the client handles this much better, but
> obviously that doenst do much good when using the client with AMQP 0-9-1
> since that requires the use of BindingURLs.
>
>
>> Would it not be worthwhile having a plane property object with
>> these properties that can be passed to the method? Defaults values,
>> possibly
>> based on system env values, could be set on object creation and reset.
>> Additional methods without the property object could also be provided
>> where
>> system defaults are assumed.
>>
>>
> The issue is not really how the values gets (in)to the method, but where
> the exchange property values actually come from. The changes you have
> mentioned so far involved repurposing the existing options intended for the
> queue (the BindingURL syntax doesnt define a way of setting exchange
> properties, which is presumably why the values were hard coded in the
> declares), which doesn't really work since it prevents various combinations
> such as differing durability for a queue and exchange, and would also
> change the clients behaviour for all the existing users.
>
> I have raised a JIRA ( https://issues.apache.org/jira/browse/QPID-4261 )
> to extend the BindingURL sytax to provide options for the exchanges which
> can then be used via the (AMQ)Destination object (in similar fashion to the
> queue options) when sending the ExchangeDeclare commands during
> consumer/producer creation. I have done some of the work already but it
> could be a few days before I get enough time in the evening to finish it. I
> have attached a couple of work-in-progress patches to the JIRA which you
> can have a look at to see where im going with it.
>
>
>>
>> Concerning your comments on the 'noWait' issue. I was concerned that while
>> my changes did solve my 0-9-1 issues, it might create regression issues
>> and
>> break the same use case running against a broker operating a different amq
>> version. It appears that you are in a similar boat. So am I out of luck
>> here
>> and should simply run with my local modifications? I'm caught in a hard
>> spot
>> here as our objective is transparent JMS and AMQ regardless of version.
>>
>>
> What I was trying to get at with my comments is that I think the
> abstraction of the clients 0-8/0-9/0-9-1 and 0-10 protocol implementations
> in that area isnt particularly pretty at all, but it doesnt appear to be
> the cause of any issue. The 0-8/0-9/0-9-1 and 0-10 paths of the client do
> treat that value differently becaues the protocol actually is different in
> that area, and the historic behaviour of the client for 0-8/0-9/0-9-1 users
> was retained when the 0-10 support was added. As such it seems likely that
> the changes you made actually caused the issue you saw.
>
> The (hard coded) values used for noWait in the queue/exchange declare
> commands in the 0-8/0-9/0-9-1 path are appropriate to what the various
> areas of code are trying to do and I believe should remain as-is, so
> possible explanations for the problem would seem to be either that your
> changes resulted in an inappropriate combination (a declare command with
> noWait=true being sent by a section of code that expected/required it to be
> false, resulting in the client waiting for a response it had just
> explicitly asked the broker never to send), or that the RabbitMQ broker has
> a bug. In this particular scenario the latter seems unlikely, which
> suggests the first option.
>
> I dont see any need to change the noWait handling here, the main issue for
> you is being able to set the exchange properties (auto-delete,
> durable...probably not internal, I'd have to wonder about creating
> 'internal' exchanges with a client given that the point is they are
> 'internal wiring') so that the brokers validation of the incoming exchange
> declare matches the properties found on the pre existing exchange, which we
> will get done via the JIRA mentioned above.
>
> Robbie
>
>>
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://qpid.2158936.n2.nabble.com/Hard-coded-destination-parameters-prevent-creation-of-Producer-and-Consumer-tp7581160p7581325.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
>>
>>
>

Re: Hard-coded destination parameters prevent creation of Producer and Consumer

Posted by Robbie Gemmell <ro...@gmail.com>.
On 27 August 2012 20:39, Roger <ro...@pason.com> wrote:

> > If disabling the queue and exchange declares is
> > an option for you (i.e you can rely on them being present already) then
> > you
> > should be able to use that change along with the system properties I
> > mentioned to do so. If not, we can try to work out a suitable course to
> > allow manipulating the exchange declare properties.
>
> We are running a mixed bag here. Some queues are predefined, while others
> (actually system named topics) are temporary and defined on the fly.
> Consequently, the proposed solution doesn't address all our use cases.
> I find it odd that qpid.declare_exchanges is a global parameter as it
> implies an all-or-none configuration approach.


Ok. I only brought it up because I spotted them while looking into what you
were seeing and wondered if it would work since you had mentioned using
predefined destinations. The properties arent really documented or even
intended for regular use I believe, but someone obviously had a use case at
some point and added them.


> Most, if not all, my
> experience in messaging systems have always leveraged on-the-fly
> queue/topic
> creation.


On-the-fly queue and topic creation is supported and indeed fairly usual,
the problem is your custom exchanges are not something the Qpid JMS client
handles well since it historically hasn't catered for that (mainly sticking
to the pre-existing amq. exchanges) and has never saw much/any use of where
0-8/0-9/0-9-1 + BindingURLs are concerned. The newer 'Address' syntax
supported by the AMQP 0-10 path of the client handles this much better, but
obviously that doenst do much good when using the client with AMQP 0-9-1
since that requires the use of BindingURLs.


> Would it not be worthwhile having a plane property object with
> these properties that can be passed to the method? Defaults values,
> possibly
> based on system env values, could be set on object creation and reset.
> Additional methods without the property object could also be provided where
> system defaults are assumed.
>
>
The issue is not really how the values gets (in)to the method, but where
the exchange property values actually come from. The changes you have
mentioned so far involved repurposing the existing options intended for the
queue (the BindingURL syntax doesnt define a way of setting exchange
properties, which is presumably why the values were hard coded in the
declares), which doesn't really work since it prevents various combinations
such as differing durability for a queue and exchange, and would also
change the clients behaviour for all the existing users.

I have raised a JIRA ( https://issues.apache.org/jira/browse/QPID-4261 ) to
extend the BindingURL sytax to provide options for the exchanges which can
then be used via the (AMQ)Destination object (in similar fashion to the
queue options) when sending the ExchangeDeclare commands during
consumer/producer creation. I have done some of the work already but it
could be a few days before I get enough time in the evening to finish it. I
have attached a couple of work-in-progress patches to the JIRA which you
can have a look at to see where im going with it.


>
> Concerning your comments on the 'noWait' issue. I was concerned that while
> my changes did solve my 0-9-1 issues, it might create regression issues and
> break the same use case running against a broker operating a different amq
> version. It appears that you are in a similar boat. So am I out of luck
> here
> and should simply run with my local modifications? I'm caught in a hard
> spot
> here as our objective is transparent JMS and AMQ regardless of version.
>
>
What I was trying to get at with my comments is that I think the
abstraction of the clients 0-8/0-9/0-9-1 and 0-10 protocol implementations
in that area isnt particularly pretty at all, but it doesnt appear to be
the cause of any issue. The 0-8/0-9/0-9-1 and 0-10 paths of the client do
treat that value differently becaues the protocol actually is different in
that area, and the historic behaviour of the client for 0-8/0-9/0-9-1 users
was retained when the 0-10 support was added. As such it seems likely that
the changes you made actually caused the issue you saw.

The (hard coded) values used for noWait in the queue/exchange declare
commands in the 0-8/0-9/0-9-1 path are appropriate to what the various
areas of code are trying to do and I believe should remain as-is, so
possible explanations for the problem would seem to be either that your
changes resulted in an inappropriate combination (a declare command with
noWait=true being sent by a section of code that expected/required it to be
false, resulting in the client waiting for a response it had just
explicitly asked the broker never to send), or that the RabbitMQ broker has
a bug. In this particular scenario the latter seems unlikely, which
suggests the first option.

I dont see any need to change the noWait handling here, the main issue for
you is being able to set the exchange properties (auto-delete,
durable...probably not internal, I'd have to wonder about creating
'internal' exchanges with a client given that the point is they are
'internal wiring') so that the brokers validation of the incoming exchange
declare matches the properties found on the pre existing exchange, which we
will get done via the JIRA mentioned above.

Robbie

>
>
>
>
>
>
>
> --
> View this message in context:
> http://qpid.2158936.n2.nabble.com/Hard-coded-destination-parameters-prevent-creation-of-Producer-and-Consumer-tp7581160p7581325.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
>
>

Re: Hard-coded destination parameters prevent creation of Producer and Consumer

Posted by Roger <ro...@pason.com>.
> If disabling the queue and exchange declares is
> an option for you (i.e you can rely on them being present already) then
> you
> should be able to use that change along with the system properties I
> mentioned to do so. If not, we can try to work out a suitable course to
> allow manipulating the exchange declare properties. 

We are running a mixed bag here. Some queues are predefined, while others
(actually system named topics) are temporary and defined on the fly.
Consequently, the proposed solution doesn't address all our use cases.
I find it odd that qpid.declare_exchanges is a global parameter as it
implies an all-or-none configuration approach. Most, if not all, my
experience in messaging systems have always leveraged on-the-fly queue/topic
creation. Would it not be worthwhile having a plane property object with
these properties that can be passed to the method? Defaults values, possibly
based on system env values, could be set on object creation and reset.
Additional methods without the property object could also be provided where
system defaults are assumed.


Concerning your comments on the 'noWait' issue. I was concerned that while
my changes did solve my 0-9-1 issues, it might create regression issues and
break the same use case running against a broker operating a different amq
version. It appears that you are in a similar boat. So am I out of luck here
and should simply run with my local modifications? I'm caught in a hard spot
here as our objective is transparent JMS and AMQ regardless of version.








--
View this message in context: http://qpid.2158936.n2.nabble.com/Hard-coded-destination-parameters-prevent-creation-of-Producer-and-Consumer-tp7581160p7581325.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


Re: Hard-coded destination parameters prevent creation of Producer and Consumer

Posted by Robbie Gemmell <ro...@gmail.com>.
Hi Roger,

I have put a fix in via https://issues.apache.org/jira/browse/QPID-4250 for
the issue I noticed with regards to the exchange declares failing to be
inhibited by qpid.declare_exchanges=false when creating producers on
0-8/0-9/0-9-1 connnections. If disabling the queue and exchange declares is
an option for you (i.e you can rely on them being present already) then you
should be able to use that change along with the system properties I
mentioned to do so. If not, we can try to work out a suitable course to
allow manipulating the exchange declare properties.

I also took a look at some of the code you have mentioned making changes to
and now have a better idea of what happened that caused the 'hang' you
seeing as a result. The 'nowait' property of the exchangeDeclare controls
whether the broker replies to the clients command, and by making the
changes you talked of you ended up with areas of the client code doing a
'syncWrite' call with an exchangeDeclare command that had noWait=true, thus
indicating the client wasnt waiting for a reply (so the broker then didnt
reply as a result) when it actually was and so it would just sit waiting
for a reply until it eventually timing out. If the exchangeDeclare sets
noWait=true then the code writing the frame would need to do a 'non sync'
write call instead (which is what the client does when performing the
exchange declare during producer creation, because the messages being
produced have to follow that and will validate the result of the operation
implicitly). The 'noWait' parameters to some of the methods these commands
are being sent in are actually shared between the clients somewhat distinct
0-8/0-9/0-9-1 and 0-10 code paths and are sometimes only actually used by
one or the other. More confusingly still, its possible some of the noWait
parameters in those methods/classes may actually be leftovers from when the
client had an asynchronous I/O layer and so some may have nothing to do
with the queue/exchange declare attribute at all. It could defintiely use a
tidy up and possibly comments where some non-obvious things are happening.

Robbie

On 24 August 2012 16:59, Robbie Gemmell <ro...@gmail.com> wrote:

> Hi Roger,
>
> As I mentioned, some of these issues are purely down to historic behaviour
> and typical usage model of the Qpid JMS client (e.g I deal with a lot of
> users, and genuinely not one of them uses custom exchanges) and your now
> trying to use it in situations it doesnt cater particularly well to as a
> result. The Binding URL format was never intended to convey some of the
> information you are now trying to, so I'd be wary of making some of the
> changes in exactly the manner outlined so far as it would impact behaviour
> for lots of people using the client already, however I'm sure there are
> other ways we could achieve similar results whislt allowing retention of
> historic behaviour and adding the option to configure it for your needs.
>
> That said, most of the problems you are seeing and trying to work around
> look to relate to exchange and queue declares it would seem you might not
> actually need to be performed. You mentioned wanting to use pre-existing
> durable entities on your RabbitMQ broker. If so, do you actually need the
> client to declare anything for you, or can it just rely on their existence?
> If you can, there are system properties (qpid.declare_queues and
> qpid.declare_exchanges, defined near the top of AMQSession) that can be set
> to false to disable the exchange and queue declares the client does under
> the covers to hide such technicalities from users of its JMS API. I do
> notice there appears to be a gap in their usage though, where the
> 0-8/0-9/0-9-1 producer creation can still do an exchange declare in
> BasicMessageProducer_0_8#declareDestination, thats a bug I'll fix at the
> weekend.
>
> Robbie
>
>
> On 23 August 2012 21:41, Roger <ro...@pason.com> wrote:
>
>> >
>> > 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?
>>
>> I managed to resolve the hang issue. Did so by diffing communications of a
>> rabbitmq and qpid consumer. The  hard-coded nowait is set to true in
>> createExchangeDeclareBody. It appears that it can have either value when
>> creating a producer, but should be false when creating a consumer. Not
>> stating that this is necessarily correct - being knew to AMQP - but that
>> is
>> what makes the code work.
>>
>> These aforementioned discoveries lend themselves to concern.
>> I've now modified the code to accommodate the hard-coded durable and
>> autodelete values, and have changed nowait to false. Are these valid
>> changes? Should the nowait be made variable for producers? Should
>> internal,
>> and for that matter arguements (FieldTable), be made variable?
>> How do we get these changes into the next version? Bug?
>>
>> On the other hand, if these changes are not valid what is the proper usage
>> so that I can communicate with Rabbitmq.
>>
>> Roger
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://qpid.2158936.n2.nabble.com/Hard-coded-destination-parameters-prevent-creation-of-Producer-and-Consumer-tp7581160p7581249.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
>>
>>
>

Re: Hard-coded destination parameters prevent creation of Producer and Consumer

Posted by Robbie Gemmell <ro...@gmail.com>.
Hi Roger,

As I mentioned, some of these issues are purely down to historic behaviour
and typical usage model of the Qpid JMS client (e.g I deal with a lot of
users, and genuinely not one of them uses custom exchanges) and your now
trying to use it in situations it doesnt cater particularly well to as a
result. The Binding URL format was never intended to convey some of the
information you are now trying to, so I'd be wary of making some of the
changes in exactly the manner outlined so far as it would impact behaviour
for lots of people using the client already, however I'm sure there are
other ways we could achieve similar results whislt allowing retention of
historic behaviour and adding the option to configure it for your needs.

That said, most of the problems you are seeing and trying to work around
look to relate to exchange and queue declares it would seem you might not
actually need to be performed. You mentioned wanting to use pre-existing
durable entities on your RabbitMQ broker. If so, do you actually need the
client to declare anything for you, or can it just rely on their existence?
If you can, there are system properties (qpid.declare_queues and
qpid.declare_exchanges, defined near the top of AMQSession) that can be set
to false to disable the exchange and queue declares the client does under
the covers to hide such technicalities from users of its JMS API. I do
notice there appears to be a gap in their usage though, where the
0-8/0-9/0-9-1 producer creation can still do an exchange declare in
BasicMessageProducer_0_8#declareDestination, thats a bug I'll fix at the
weekend.

Robbie

On 23 August 2012 21:41, Roger <ro...@pason.com> wrote:

> >
> > 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?
>
> I managed to resolve the hang issue. Did so by diffing communications of a
> rabbitmq and qpid consumer. The  hard-coded nowait is set to true in
> createExchangeDeclareBody. It appears that it can have either value when
> creating a producer, but should be false when creating a consumer. Not
> stating that this is necessarily correct - being knew to AMQP - but that is
> what makes the code work.
>
> These aforementioned discoveries lend themselves to concern.
> I've now modified the code to accommodate the hard-coded durable and
> autodelete values, and have changed nowait to false. Are these valid
> changes? Should the nowait be made variable for producers? Should internal,
> and for that matter arguements (FieldTable), be made variable?
> How do we get these changes into the next version? Bug?
>
> On the other hand, if these changes are not valid what is the proper usage
> so that I can communicate with Rabbitmq.
>
> Roger
>
>
>
>
> --
> View this message in context:
> http://qpid.2158936.n2.nabble.com/Hard-coded-destination-parameters-prevent-creation-of-Producer-and-Consumer-tp7581160p7581249.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
>
>

Re: Hard-coded destination parameters prevent creation of Producer and Consumer

Posted by Roger <ro...@pason.com>.
>
> 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? 

I managed to resolve the hang issue. Did so by diffing communications of a
rabbitmq and qpid consumer. The  hard-coded nowait is set to true in
createExchangeDeclareBody. It appears that it can have either value when
creating a producer, but should be false when creating a consumer. Not
stating that this is necessarily correct - being knew to AMQP - but that is
what makes the code work.

These aforementioned discoveries lend themselves to concern.
I've now modified the code to accommodate the hard-coded durable and
autodelete values, and have changed nowait to false. Are these valid
changes? Should the nowait be made variable for producers? Should internal,
and for that matter arguements (FieldTable), be made variable? 
How do we get these changes into the next version? Bug?

On the other hand, if these changes are not valid what is the proper usage
so that I can communicate with Rabbitmq. 

Roger




--
View this message in context: http://qpid.2158936.n2.nabble.com/Hard-coded-destination-parameters-prevent-creation-of-Producer-and-Consumer-tp7581160p7581249.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


Re: Hard-coded destination parameters prevent creation of Producer and Consumer

Posted by Roger <ro...@pason.com>.
Failed to mention that I'm using java client 0.16.

Roger



--
View this message in context: http://qpid.2158936.n2.nabble.com/Hard-coded-destination-parameters-prevent-creation-of-Producer-and-Consumer-tp7581160p7581161.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


Re: Hard-coded destination parameters prevent creation of Producer and Consumer

Posted by Roger <ro...@pason.com>.
> 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?


Unfortunately, rabbits aren't very noisy creatures. Outside of the
established and closed connection, the logs are clear. Consuming from the
amq.rabbitmq.log offered no more.
The output from client is below. Someone might catch a misconfiguration or
something.

Roger


[INFO ]-[main] : No Provider URL specified.
[DEBUG]-[main] : Parsing URL:
direct://myExchange//myQueue?autodelete='false'&durable='true'&internal='false'&routingkey='testRoute'
[DEBUG]-[main] : URL Parsed:
direct://myExchange//myQueue?autodelete='false'&routingkey='testRoute'&durable='true'&internal='false'
[DEBUG]-[main] : Based on
direct://myExchange//myQueue?autodelete='false'&routingkey='testRoute'&durable='true'&internal='false'
the selected destination syntax is BURL
[DEBUG]-[main] : AMQP version 0-91
[INFO ]-[main] :
Connection:amqp://guest:********@localhost/?brokerlist='tcp://localhost:5672'
[INFO ]-[main] : Using ProtocolVersion for Session:0-91
[INFO ]-[main] : New Method Dispatcher:AMQProtocolSession[null]
[DEBUG]-[main] : Creating content header body factory
[DEBUG]-[main] : Creating content body factory
[INFO ]-[main] : Connecting with ProtocolHandler Version:0-91
[INFO ]-[main] : New StateWaiter :AMQState: id = 1 name:
CONNECTION_NOT_STARTED:[AMQState: id = 4 name: CONNECTION_OPEN, AMQState: id
=
6 name: CONNECTION_CLOSED]
[DEBUG]-[main] : SO_RCVBUF : 65535
[DEBUG]-[main] : SO_SNDBUF : 65535
[DEBUG]-[main] : TCP_NODELAY : true
[DEBUG]-[main] : Sent 1 protocol messages
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : (650188911)Method frame
received: [ConnectionStartBodyImpl: versionMajor=0, versionMinor=9,
serverProperties={capabilities=[FIELD_TABLE: {publisher_confirms=[BOOLEAN:
true], exchange_exchange_bindings=[BOOLEAN: true], basic.nack=[BOOLEAN:
true],
consumer_cancel_notify=[BOOLEAN: true]}], copyright=[LONG_STRING: Copyright
(C) 2007-2012 VMware, Inc.], information=[LONG_STRING: Licensed under the
MPL.
See http://www.rabbitmq.com/], platform=[LONG_STRING: Erlang/OTP],
product=[LONG_STRING: RabbitMQ], version=[LONG_STRING: 2.8.5]},
mechanisms=[80, 76, 65, 73, 78, 32, 65, 77, 81, 80, 76, 65, 73, 78],
locales=[101, 110, 95, 85, 83]]
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : public void
methodReceived(AMQStateManager stateManager, AMQProtocolSession
protocolSession, AMQMethodEvent evt): called
[INFO ]-[IoReceiver - localhost/127.0.0.1:5672] : Setting ProtocolVersion to
:0-91
[INFO ]-[IoReceiver - localhost/127.0.0.1:5672] : New Method
Dispatcher:AMQProtocolSession[AMQConnection:
Host: localhost
Port: 5672
Virtual Host: 
Client ID: localhost
Active session count: 0]
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : public static void
registerSaslProviders(): called
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : props =
{ANONYMOUS=org.apache.qpid.client.security.anonymous.AnonymousSaslClientFactory,
CRAM-MD5-HASHED=org.apache.qpid.client.security.crammd5hashed.CRAMMD5HashedSaslClientFactory,
AMQPLAIN=org.apache.qpid.client.security.amqplain.AmqPlainSaslClientFactory}
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : Registering class
org.apache.qpid.client.security.anonymous.AnonymousSaslClientFactory for
mechanism ANONYMOUS
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : Registering class
org.apache.qpid.client.security.crammd5hashed.CRAMMD5HashedSaslClientFactory
for mechanism CRAM-MD5-HASHED
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : Registering class
org.apache.qpid.client.security.amqplain.AmqPlainSaslClientFactory for
mechanism AMQPLAIN
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : Registered SASL Client
factory for AMQPLAIN as
org.apache.qpid.client.security.amqplain.AmqPlainSaslClientFactory
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : Registered SASL Client
factory for ANONYMOUS as
org.apache.qpid.client.security.anonymous.AnonymousSaslClientFactory
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : Registered SASL Client
factory for CRAM-MD5-HASHED as
org.apache.qpid.client.security.crammd5hashed.CRAMMD5HashedSaslClientFactory
[INFO ]-[IoReceiver - localhost/127.0.0.1:5672] : Additional SASL providers
successfully registered.
[INFO ]-[IoReceiver - localhost/127.0.0.1:5672] : Callback handlers
available
for SASL mechanisms: [EXTERNAL, GSSAPI, CRAM-MD5-HASHED, CRAM-MD5, AMQPLAIN,
PLAIN, ANONYMOUS]
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : mechanism = AMQPLAIN
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : State changing to
AMQState:
id = 2 name: CONNECTION_NOT_TUNED from old state AMQState: id = 1 name:
CONNECTION_NOT_STARTED
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : Notififying State change
to
1 : [org.apache.qpid.client.state.StateWaiter@44323274]
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : Dumping QpidProperties
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : Property: qpid.version
Value: 0.16
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : Property: qpid.svnversion
Value: exported
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : Property: qpid.name Value:
qpid
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : End of property dump
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : FieldTable::writeToBuffer:
Writing encoded length of 244...
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : {instance=[LONG_STRING:
localhost], product=[LONG_STRING: qpid], version=[LONG_STRING: 0.16],
platform=[LONG_STRING: Java(TM) SE Runtime Environment, 1.6.0_27-b07, Sun
Microsystems Inc., amd64, Linux, 2.6.18-92.1.22.el5, unknown],
qpid.client_process=[LONG_STRING: Qpid Java Client], qpid.client_pid=[INT:
19674]}
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : (650188911)Method frame
received: [ConnectionTuneBodyImpl: channelMax=0, frameMax=131072,
heartbeat=0]
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : ConnectionTune frame
received
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : State changing to
AMQState:
id = 3 name: CONNECTION_NOT_OPENED from old state AMQState: id = 2 name:
CONNECTION_NOT_TUNED
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : Notififying State change
to
1 : [org.apache.qpid.client.state.StateWaiter@44323274]
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : (650188911)Method frame
received: [ConnectionOpenOkBodyImpl: knownHosts=null]
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : State changing to
AMQState:
id = 4 name: CONNECTION_OPEN from old state AMQState: id = 3 name:
CONNECTION_NOT_OPENED
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : Notififying State change
to
1 : [org.apache.qpid.client.state.StateWaiter@44323274]
[DEBUG]-[main] : Are we connected:true
[INFO ]-[main] : Connected with ProtocolHandler Version:0-91
[DEBUG]-[main] : Write channel open frame for channel id 1
[INFO ]-[main] : Created
session:org.apache.qpid.client.AMQSession_0_8@6dbe4663
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : (650188911)Method frame
received: [ChannelOpenOkBodyImpl: channelId=null]
[DEBUG]-[IoReceiver - localhost/127.0.0.1:5672] : (650188911)Method frame
received: [BasicQosOkBodyImpl: ]
[INFO ]-[main] : MessageProducer
org.apache.qpid.client.BasicMessageProducer_0_8@74d402dd using publish mode
:
ASYNC_PUBLISH_ALL
javax.jms.JMSException: Error registering consumer:
org.apache.qpid.AMQTimeoutException: Server did not respond in a timely
fashion [error code 408: Request Timeout]
	at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:2048)
	at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:2000)
	at
org.apache.qpid.client.AMQConnectionDelegate_8_0.executeRetrySupport(AMQConnectionDelegate_8_0.java:324)
	at
org.apache.qpid.client.AMQConnection.executeRetrySupport(AMQConnection.java:577)
	at
org.apache.qpid.client.failover.FailoverRetrySupport.execute(FailoverRetrySupport.java:102)
	at
org.apache.qpid.client.AMQSession.createConsumerImpl(AMQSession.java:1998)
	at
org.apache.qpid.client.AMQSession.createConsumer(AMQSession.java:972)
	at
com.xyz.transport.example.Hello.runRabbitProduceConsume(Hello.java:110)
	at com.xyz.transport.example.Hello.main(Hello.java:52)
Caused by: org.apache.qpid.AMQTimeoutException: Server did not respond in a
timely fashion [error code 408: Request Timeout]
	at
org.apache.qpid.client.util.BlockingWaiter.block(BlockingWaiter.java:178)
	at
org.apache.qpid.client.protocol.BlockingMethodFrameListener.blockForFrame(BlockingMethodFrameListener.java:122)
	at
org.apache.qpid.client.protocol.AMQProtocolHandler.writeCommandFrameAndWaitForReply(AMQProtocolHandler.java:655)
	at
org.apache.qpid.client.protocol.AMQProtocolHandler.syncWrite(AMQProtocolHandler.java:676)
	at
org.apache.qpid.client.protocol.AMQProtocolHandler.syncWrite(AMQProtocolHandler.java:670)
	at
org.apache.qpid.client.AMQSession_0_8.sendExchangeDeclare(AMQSession_0_8.java:406)
	at org.apache.qpid.client.AMQSession$9.execute(AMQSession.java:2711)
	at
org.apache.qpid.client.failover.FailoverNoopSupport.execute(FailoverNoopSupport.java:67)
	at
org.apache.qpid.client.AMQSession.declareExchange(AMQSession.java:2707)
	at
org.apache.qpid.client.AMQSession.registerConsumer(AMQSession.java:2922)
	at org.apache.qpid.client.AMQSession.access$500(AMQSession.java:97)
	at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:2025)
	... 8 more






--
View this message in context: http://qpid.2158936.n2.nabble.com/Hard-coded-destination-parameters-prevent-creation-of-Producer-and-Consumer-tp7581160p7581220.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


Re: Hard-coded destination parameters prevent creation of Producer and Consumer

Posted by Robbie Gemmell <ro...@gmail.com>.
On 21 August 2012 16:51, Roger <ro...@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
>
>