Qpid
  1. Qpid
  2. QPID-4238

Virtual hosts or queues with dots in their names do not work

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.19
    • Fix Version/s: 0.19
    • Component/s: Java Broker
    • Labels:
      None

      Description

      The latest version of the Qpid Java broker seems to have a problem with the virtual hosts and queues containing a dot in their name. This is related to the way the virtualhosts.xml configuration file is designed. When a queue is defined, the <queue> tag contains only the <name> tag with the queue name and a tag named after the queue which contains additional details. E.g.

      <queue>
      <name>queue.with.dot.in.the.name</name>
      <queue.with.dot.in.the.name>
      <durable>true</durable>
      </queue.with.dot.in.the.name>
      </queue>

      Unfortunately the dots are also used as special characters when working with the configuration file - they are used as delimiters in the XML hierarchy. In order to use them in the tag names, they need to be escaped with additional dot (i.e. queue..with..dot..in..the..name instead of queue.with.dot.in.the.name - http://commons.apache.org/configuration/userguide-1.2/howto_xml.html). This escaping doesn't seem to be currently done on the broker. As a result, the dots cannot be used in virtual host names or in queue names, which might be unfortunate for some users.

      1. QPID-4238.patch
        3 kB
        JAkub Scholz
      2. QPID-4238-tests.patch
        3 kB
        JAkub Scholz

        Activity

        Hide
        JAkub Scholz added a comment -

        Attached patch adds new escapeTagName method to the class ConfigurationPlugin and uses this method to escape the dots when loading the virtual hosts and the queues in ServerConfiguration and QueueConfiguration classes. Please let me know in case there should be something changed in the patch.

        Show
        JAkub Scholz added a comment - Attached patch adds new escapeTagName method to the class ConfigurationPlugin and uses this method to escape the dots when loading the virtual hosts and the queues in ServerConfiguration and QueueConfiguration classes. Please let me know in case there should be something changed in the patch.
        Hide
        Robbie Gemmell added a comment -

        Hi Jakub,

        I must admit to us having known about this defect for a while. It is as you have noticed related to the Commons Configuration usage, and as such is linked to the xml config files rather than an inherant limitation of the broker. Although I can't admit to having tried it (our users dont tend to use dots so it has never become a priority) the JMX/HTTP interfaces shouldnt present any such restriction (but obviously cant currently create virtualhosts...though it is coming).

        We will take a look at the patch later in the week probably (a bit swamped at the moment, hence the 11pm reply) and apply it if all seems well. It's probably worth me mentioning that we are currently undertaking a long term project to rework the broker management and configuration, including removal of the XML configuration hopefully for 0.20, so this was getting resolved one way or the other, but thank you for the patch in the meantime

        Show
        Robbie Gemmell added a comment - Hi Jakub, I must admit to us having known about this defect for a while. It is as you have noticed related to the Commons Configuration usage, and as such is linked to the xml config files rather than an inherant limitation of the broker. Although I can't admit to having tried it (our users dont tend to use dots so it has never become a priority) the JMX/HTTP interfaces shouldnt present any such restriction (but obviously cant currently create virtualhosts...though it is coming). We will take a look at the patch later in the week probably (a bit swamped at the moment, hence the 11pm reply) and apply it if all seems well. It's probably worth me mentioning that we are currently undertaking a long term project to rework the broker management and configuration, including removal of the XML configuration hopefully for 0.20, so this was getting resolved one way or the other, but thank you for the patch in the meantime
        Hide
        Keith Wall added a comment -

        Hi Jakub

        I see no problem with this patch. The dot is legal in both queue names and virtual hostnames from a AMQP 0.8..0-10 perspective, so I can see no reason why you should not be able to specify these names in the config file too. I do however think the patch would benefit from the additional of a unit test. I would look at adding a test to ServerConfigurationTest and/or VirtualHostConfigurationTest.

        Be aware that we are planning to remove the config.xml and virtualhost.xml files from the Broker at some point in the near future. It is envisaged that all configuration will be stored in the store, and all objects (including virtualhosts) will be created/destroyed via the management interfaces.

        Show
        Keith Wall added a comment - Hi Jakub I see no problem with this patch. The dot is legal in both queue names and virtual hostnames from a AMQP 0.8..0-10 perspective, so I can see no reason why you should not be able to specify these names in the config file too. I do however think the patch would benefit from the additional of a unit test. I would look at adding a test to ServerConfigurationTest and/or VirtualHostConfigurationTest. Be aware that we are planning to remove the config.xml and virtualhost.xml files from the Broker at some point in the near future. It is envisaged that all configuration will be stored in the store, and all objects (including virtualhosts) will be created/destroyed via the management interfaces.
        Hide
        Robbie Gemmell added a comment -

        Outstanding cross-post

        Show
        Robbie Gemmell added a comment - Outstanding cross-post
        Hide
        JAkub Scholz added a comment -

        Hi Robbie, Keith,

        I was trying to replicate existing AMQP configuration which is using the dots in queue names (originally based on the C++ broker). Since I was not familiar with all the different configuration interfaces for the broker and needed the dots I fixed it for the XML file. I have to admit I had a look at the unit tests but they looked to me more complicated then the actual fix, so I decided to take a short cut and skip them :-o. I will try to find some time today/tomorrow to have a second look at them.

        It is good to know about the planned changes in the management interfaces, I will try to avoid the XML configuration in our long term plans.

        Regards
        Jakub

        Show
        JAkub Scholz added a comment - Hi Robbie, Keith, I was trying to replicate existing AMQP configuration which is using the dots in queue names (originally based on the C++ broker). Since I was not familiar with all the different configuration interfaces for the broker and needed the dots I fixed it for the XML file. I have to admit I had a look at the unit tests but they looked to me more complicated then the actual fix, so I decided to take a short cut and skip them :-o. I will try to find some time today/tomorrow to have a second look at them. It is good to know about the planned changes in the management interfaces, I will try to avoid the XML configuration in our long term plans. Regards Jakub
        Hide
        JAkub Scholz added a comment -

        Hi Keith,

        I prepared two tests - one for queue names and one for virtual hosts name. The way I tested it is that I add a new queue/host with a configuration (max delivery count / message store) detail contained in the tag with queue/host name. Then I check that the property was correctly loaded. It may not be the best approach, but it definitely fails without my patch and succeeds with the patch.

        Regards
        Jakub

        Show
        JAkub Scholz added a comment - Hi Keith, I prepared two tests - one for queue names and one for virtual hosts name. The way I tested it is that I add a new queue/host with a configuration (max delivery count / message store) detail contained in the tag with queue/host name. Then I check that the property was correctly loaded. It may not be the best approach, but it definitely fails without my patch and succeeds with the patch. Regards Jakub
        Hide
        Robbie Gemmell added a comment -

        Patches applied (sorry about the delay) after some trivial whitespace fixes.

        Show
        Robbie Gemmell added a comment - Patches applied (sorry about the delay) after some trivial whitespace fixes.
        Hide
        JAkub Scholz added a comment -

        Thanks Robbie ...

        Show
        JAkub Scholz added a comment - Thanks Robbie ...

          People

          • Assignee:
            Robbie Gemmell
            Reporter:
            JAkub Scholz
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development