[
https://issues.apache.org/jira/browse/QPID-6547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14585072#comment-14585072
]
Rob Godfrey commented on QPID-6547:
-----------------------------------
The above seems reasonable, but I think we should also guard against cases
where the address implies a request to bind to the default exchange. For
instance the following code:
{code}
final Queue destination =
session.createQueue("direct:////foo/bar/baz?routingkey='/foo/bar/baz'");
MessageConsumer consumer = session.createConsumer(destination);
{code}
will cause the following exception
{noformat}
Exception in thread "main" javax.jms.JMSException: Error registering consumer:
org.apache.qpid.client.AMQAuthenticationException: Cannot bind the queue
'foo/bar/baz' to the default exchange [error code 530: not allowed]
at
org.apache.qpid.client.AMQSession.toJMSException(AMQSession.java:3645)
at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:2083)
at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:2037)
at
org.apache.qpid.client.AMQConnectionDelegate_8_0.executeRetrySupport(AMQConnectionDelegate_8_0.java:413)
at
org.apache.qpid.client.AMQConnection.executeRetrySupport(AMQConnection.java:733)
at
org.apache.qpid.client.failover.FailoverRetrySupport.execute(FailoverRetrySupport.java:90)
at
org.apache.qpid.client.AMQSession.createConsumerImpl(AMQSession.java:2035)
at org.apache.qpid.client.AMQSession.createConsumer(AMQSession.java:980)
at org.apache.qpid.AMQPManagementTest.main(AMQPManagementTest.java:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: org.apache.qpid.client.AMQAuthenticationException: Cannot bind the
queue 'foo/bar/baz' to the default exchange [error code 530: not allowed]
at
org.apache.qpid.client.handler.ConnectionCloseMethodHandler.methodReceived(ConnectionCloseMethodHandler.java:78)
at
org.apache.qpid.client.handler.ClientMethodDispatcherImpl.dispatchConnectionClose(ClientMethodDispatcherImpl.java:227)
at
org.apache.qpid.framing.ConnectionCloseBody.execute(ConnectionCloseBody.java:116)
at
org.apache.qpid.client.state.AMQStateManager.methodReceived(AMQStateManager.java:116)
{noformat}
Similarly the following address should detected as erroneous client side,
before attempting to redefine the default exchange
{code}
final Topic destination = session.createTopic("topic:////foo/bar/baz");
MessageConsumer consumer = session.createConsumer(destination);
{code}
which gives
{noformat}
Exception in thread "main" javax.jms.JMSException: Error registering consumer:
org.apache.qpid.client.AMQAuthenticationException: Attempt to redeclare default
exchange: of type direct to topic. [error code 530: not allowed]
at
org.apache.qpid.client.AMQSession.toJMSException(AMQSession.java:3645)
at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:2083)
at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:2037)
at
org.apache.qpid.client.AMQConnectionDelegate_8_0.executeRetrySupport(AMQConnectionDelegate_8_0.java:413)
at
org.apache.qpid.client.AMQConnection.executeRetrySupport(AMQConnection.java:733)
at
org.apache.qpid.client.failover.FailoverRetrySupport.execute(FailoverRetrySupport.java:90)
at
org.apache.qpid.client.AMQSession.createConsumerImpl(AMQSession.java:2035)
at org.apache.qpid.client.AMQSession.createConsumer(AMQSession.java:980)
at org.apache.qpid.AMQPManagementTest.main(AMQPManagementTest.java:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: org.apache.qpid.client.AMQAuthenticationException: Attempt to
redeclare default exchange: of type direct to topic. [error code 530: not
allowed]
at
org.apache.qpid.client.handler.ConnectionCloseMethodHandler.methodReceived(ConnectionCloseMethodHandler.java:78)
{noformat}
> [Java Client] Client should not attempt to make explicit bindings against the
> default exchange
> ----------------------------------------------------------------------------------------------
>
> Key: QPID-6547
> URL: https://issues.apache.org/jira/browse/QPID-6547
> Project: Qpid
> Issue Type: Bug
> Components: Java Client
> Reporter: Rob Godfrey
>
> With a default address mode of BURL, an address string like "/a/b/c/d" is
> treated as if it is an attempt to bind an address to the default (no-name)
> exchange.
> Attempting to parse such addresses as BURLs should fail. The client should
> stop any attempt to create explicit bindings to the default exchange.
> Attempts to use the default exchange for topics are probably dubious and
> should maybe generate a warning.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]