Qpid
  1. Qpid
  2. QPID-4442

x-match fails to match properties

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.18
    • Fix Version/s: 0.19
    • Component/s: C++ Broker
    • Labels:
      None
    • Environment:

      CentOS 6.2

      Description

      Using the spout/drain messaging example. I run the spout like this:
      spout -P source:sports -c 1 my_exchange

      And I run drain like this:
      drain -f "my_queue; {create:receiver, node:{x-declare:

      {auto-delete:true}

      ,x-bindings:[{exchange:'my_exchange',queue:'my_queue,key:'key',arguments:{x-match:any,source:'sports'}}]}}"

      Using a drain built on version v0.14, this works, the source property is correctly matched and messages are correctly routed to the drain through a v0.18 C++ broker; using a drain built in version v0.18, messages are not routed to the drain's queue.

      Further inspection (at the packet level) shows that the difference is that in the exchange.bind method on the drain side, 'sports' is encoded as a variable binary (0x90) in v0.14, but a string (0x95) in v0.18.

        Activity

        Lance Doran created issue -
        Lance Doran made changes -
        Field Original Value New Value
        Description Using the spout/drain messaging example. I run the spout like this:
        spout -P source:sports -c 1 my_exchange

        And I run drain like this:
        drain -f "my_queue; {create:receiver, node:{x-declare:{auto-delete:true},x-bindings:[{exchange:'my_exchange',queue:'my_queue,key:'key',arguments:{x-match:any,source:'sports'}}]}}"

        Using a drain built on version v0.14, this works and messages are correctly routed to the drain through the v0.18 C++ broker; using a drain built in version v0.18, messages not.

        Further inspection (at the packet level) shows that the difference is that in the exchange.bind method on the drain side, 'sports' is encoded as a variable binary (0x90) in v0.14, but a string (0x95) in v0.18.

        Using the spout/drain messaging example. I run the spout like this:
        spout -P source:sports -c 1 my_exchange

        And I run drain like this:
        drain -f "my_queue; {create:receiver, node:{x-declare:{auto-delete:true},x-bindings:[{exchange:'my_exchange',queue:'my_queue,key:'key',arguments:{x-match:any,source:'sports'}}]}}"

        Using a drain built on version v0.14, this works, the source property is correctly matched and messages are correctly routed to the drain through a v0.18 C++ broker; using a drain built in version v0.18, messages are not routed to the drain's queue.

        Further inspection (at the packet level) shows that the difference is that in the exchange.bind method on the drain side, 'sports' is encoded as a variable binary (0x90) in v0.14, but a string (0x95) in v0.18.

        Hide
        Gordon Sim added a comment -

        This is 'fixed' on trunk already actually; the headers exchange now compares the bytes regardless of encoding. However you can also make a simple change to spout that will cause it to send the property as a str16:

        Index: examples/messaging/spout.cpp
        ===================================================================
        --- examples/messaging/spout.cpp	(revision 1410578)
        +++ examples/messaging/spout.cpp	(working copy)
        @@ -91,6 +91,7 @@
                 std::string value;
                 if (nameval(property, name, value)) {
                     message.getProperties()[name] = value;
        +            message.getProperties()[name].setEncoding("utf8");
                 } else {
                     message.getProperties()[name] = Variant();
                 }    
        

        I'll commit that change as well as there is really no good reason to send the property as anything other than a utf8 encoded string.

        Show
        Gordon Sim added a comment - This is 'fixed' on trunk already actually; the headers exchange now compares the bytes regardless of encoding. However you can also make a simple change to spout that will cause it to send the property as a str16: Index: examples/messaging/spout.cpp =================================================================== --- examples/messaging/spout.cpp (revision 1410578) +++ examples/messaging/spout.cpp (working copy) @@ -91,6 +91,7 @@ std::string value; if (nameval(property, name, value)) { message.getProperties()[name] = value; + message.getProperties()[name].setEncoding("utf8"); } else { message.getProperties()[name] = Variant(); } I'll commit that change as well as there is really no good reason to send the property as anything other than a utf8 encoded string.
        Gordon Sim made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Gordon Sim [ gsim ]
        Resolution Fixed [ 1 ]
        Hide
        Lance Doran added a comment -

        Yep. The workaround seemed to make the broker happy. And I did a git pull off trunk and it worked like a champ too. Thanks!

        Show
        Lance Doran added a comment - Yep. The workaround seemed to make the broker happy. And I did a git pull off trunk and it worked like a champ too. Thanks!
        Justin Ross made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Gordon Sim
            Reporter:
            Lance Doran
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development