Review Board 1.7.22


QPID-3265 Can't subscribe to headers exchange using address (rather than BURL)

Review Request #937 - Created June 20, 2011 and discarded

rajith attapattu
QPID-3265
Reviewers
qpid
qpid
The patch makes the following changes

1. AMQSession_0_10.java
   A default binding is only added if there are no explicit bindings specified via x-bindings

2. BasicMessageConsumer_0_10.java
   When the same destination (Topic) is used to create two different consumers the code creates a copy of the destination to ensure the second consumer gets it's own unique temp queue. When doing so we need to ensure we delete any bindings for the previous temp queue. If we don't remove old bindings and if there were no explicit bindings specified via x-bindings, then the second consumers queue will not be bound due to the logic mentioned in [1]. (Bcos the previous binding is treated as explicit bindings).

3. AddressHelper.java
   The second part of the JIRA covers a different bug - i.e x-binding specified in the link properties are not used if the node type if a queue.
    I added code to read the x-bindings in link props if there are no x-bindings specified in the node props.

4. Modified test cases
    1. To ensure that a default binding is not added when explicit bindings are specified.
    2. To fix an existing test case that relied on a default binding even when x-bindings is specified.
(*) I still need to add (or modify an existing test case) to cover the case where x-bindings are specified in link props when the node type if a queue.
The use cases specified in the JIRA were manually tested in addition to the above mentioned automated test cases.
http://svn.apache.org/repos/asf/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
Revision 1137691 New Change
[20] 1307 lines
[+20] [+] private void verifySubject(AMQDestination dest) throws AMQException
1308
                dest.setRoutingKey(new AMQShortString(""));
1308
                dest.setRoutingKey(new AMQShortString(""));
1309
                dest.setSubject("");
1309
                dest.setSubject("");
1310
            }
1310
            }
1311
        }
1311
        }
1312
    }
1312
    }
1313
    
1313

   
1314
    private void createSubscriptionQueue(AMQDestination dest) throws AMQException
1314
    private void createSubscriptionQueue(AMQDestination dest) throws AMQException
1315
    {
1315
    {
1316
        QueueNode node = (QueueNode)dest.getSourceNode();  // source node is never null
1316
        QueueNode node = (QueueNode)dest.getSourceNode();  // source node is never null
1317
        
1317

   
1318
        if (dest.getQueueName() == null)
1318
        if (dest.getQueueName() == null)
1319
        {
1319
        {
1320
            if (dest.getLink() != null && dest.getLink().getName() != null) 
1320
            if (dest.getLink() != null && dest.getLink().getName() != null)
1321
            {
1321
            {
1322
                dest.setQueueName(new AMQShortString(dest.getLink().getName())); 
1322
                dest.setQueueName(new AMQShortString(dest.getLink().getName()));
1323
            }
1323
            }
1324
        }
1324
        }
1325
        node.setExclusive(true);
1325
        node.setExclusive(true);
1326
        node.setAutoDelete(!node.isDurable());
1326
        node.setAutoDelete(!node.isDurable());
1327
        send0_10QueueDeclare(dest,null,false,true);
1327
        send0_10QueueDeclare(dest,null,false,true);

    
   
1328
        // If x-bindings is not specified, we need to add a binding.

    
   
1329
        if (node.getBindings().size() == 0)

    
   
1330
        {
1328
        node.addBinding(new Binding(dest.getAddressName(),
1331
            node.addBinding(new Binding(dest.getAddressName(),
1329
                                    dest.getQueueName(),// should have one by now
1332
                                        dest.getQueueName(),// should have one by now
1330
                                    dest.getSubject(),
1333
                                        dest.getSubject(),
1331
                                    Collections.<String,Object>emptyMap()));
1334
                                        Collections.<String,Object>emptyMap()));

    
   
1335
        }
1332
        sendQueueBind(dest.getAMQQueueName(), dest.getRoutingKey(),
1336
        sendQueueBind(dest.getAMQQueueName(), dest.getRoutingKey(),
1333
                null,dest.getExchangeName(),dest, false);
1337
                null,dest.getExchangeName(),dest, false);
1334
    }
1338
    }
1335
    
1339

   
1336
    public void setLegacyFiledsForQueueType(AMQDestination dest)
1340
    public void setLegacyFiledsForQueueType(AMQDestination dest)
1337
    {
1341
    {
1338
        // legacy support
1342
        // legacy support
1339
        dest.setQueueName(new AMQShortString(dest.getAddressName()));
1343
        dest.setQueueName(new AMQShortString(dest.getAddressName()));
1340
        dest.setExchangeName(new AMQShortString(""));
1344
        dest.setExchangeName(new AMQShortString(""));
[+20] [20] 32 lines
http://svn.apache.org/repos/asf/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java
Revision 1137691 New Change
 
http://svn.apache.org/repos/asf/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java
Revision 1137691 New Change
 
http://svn.apache.org/repos/asf/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java
Revision 1137691 New Change
 
  1. http://svn.apache.org/repos/asf/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java: Loading...
  2. http://svn.apache.org/repos/asf/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java: Loading...
  3. http://svn.apache.org/repos/asf/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java: Loading...
  4. http://svn.apache.org/repos/asf/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java: Loading...