qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robbie Gemmell (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (QPID-5601) [Java Broker] The default exchange is not really an exchange
Date Thu, 06 Mar 2014 16:26:45 GMT

    [ https://issues.apache.org/jira/browse/QPID-5601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13922705#comment-13922705
] 

Robbie Gemmell commented on QPID-5601:
--------------------------------------

https://svn.apache.org/r1574235
=============================== 
 
 - Is it possible we may have stored any bindings in the store for the default exchange (named
either <<default>>, "", or null), and need to get rid of or ignore them in future?
 
 - We have a constant for the exchange name (ExchangeDefaults.DEFAULT_EXCHANGE_NAME) that
we should probably use:
{noformat}
@@ -380,44 +378,44 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
             DurableConfigurationStoreHelper.createQueue(getDurableConfigurationStore(), queue);
         }

-        //get the exchange name (returns default exchange name if none was specified)
+        //get the exchange name (returns empty String if none was specified)
         String exchangeName = queueConfiguration.getExchange();

-        ExchangeImpl exchange = _exchangeRegistry.getExchange(exchangeName);
-        if (exchange == null)
+
+        if("".equals(exchangeName))
{noformat}
 - As above, or there seems to be a utility method some methods are using called nameNullOrEmpty():
{noformat}
@@ -683,83 +684,101 @@ public class ServerSessionDelegate extends SessionDelegate
                 return;
             }
         }
-
-        if(method.getPassive())
+        if(method.getExchange() == null || method.getExchange().equals(""))
         {
-            ExchangeImpl exchange = getExchange(session, exchangeName);
-
-            if(exchange == null)
+            if(!DirectExchange.TYPE.getType().equals(method.getType()))
             {
-                exception(session, method, ExecutionErrorCode.NOT_FOUND, "not-found: exchange-name
'" + exchangeName + "'");
+                exception(session, method, ExecutionErrorCode.NOT_ALLOWED,
+                          "Attempt to redeclare default exchange "
+                          + " of type " + DirectExchange.TYPE.getType()
+                          + " to " + method.getType() +".");
             }
-            else
+            if(method.hasAlternateExchange() && !"".equals(method.getAlternateExchange()))
{noformat}
{noformat}
@@ -878,19 +897,30 @@ public class ServerSessionDelegate extends SessionDelegate

         ExchangeQueryResult result = new ExchangeQueryResult();

-        ExchangeImpl exchange = getExchange(session, method.getName());

-        if(exchange != null)
+        final String exchangeName = method.getName();
+
+        if(exchangeName == null || exchangeName.equals(""))
         {
{noformat}
Etc
 -  Similar comment applies to the 0-8 method handlers use of "" and AMQShortString#EMPTY_STRING.

More of an existing issue really, but your changes moved lots of the affected code in the
class so I just spotted it now...ExchangeBoundHandler has lots of cases it may generate AMQShortString
values that are of illegal length, but it only makes attempt to prevent that in 1 of the cases.
We've added additional client use of isBound() recently, so its probably much more likely
to fail going forward than in the past.This problem also applies to most of the error messages
in most of the handler classes...
 
 

> [Java Broker] The default exchange is not really an exchange
> ------------------------------------------------------------
>
>                 Key: QPID-5601
>                 URL: https://issues.apache.org/jira/browse/QPID-5601
>             Project: Qpid
>          Issue Type: Improvement
>          Components: Java Broker
>            Reporter: Rob Godfrey
>            Assignee: Rob Godfrey
>             Fix For: 0.27
>
>
> Although 0-x specifies a "no-name" default "exchange" that behaves like a direct exchange
where the queues are bound to the exchange with a binding-key equal to the queues name...
Given the advent of 1-0 it is perhaps more consistent to think of it as a "routing node" which
will take whatever is in the routing key of the inbound transfer and use that to route to
the appropriate destination (whether this be a queue or another node).
> As a first step to implementing this, we should change the implementation detail internally
such that the "default exchange" is not presented in the set of "Exchanges" and doesn't implement
the Exchange interface.
> For 0-x protocols we can "fake" it's existence as an exchange for operations such as
exchange declare / delete / bind / unbind / query



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Mime
View raw message