0

I am trying to apply a filter with qpid-proton-0.17.0 against azure eventhubs. Here is my filter code:

proton::value filter_value;
proton::codec::encoder enc(filter_value);
enc << proton::codec::start::described()
    << proton::symbol("apache.org:selector-filter:string")
    << proton::binary("amqp.annotation.x-opt-offset > '100'")
    << proton::codec::finish();
proton::source::filter_map map;
proton::symbol key("apache.org:selector-filter:string");
map.put(key, filter_value);
proton::receiver_options ro;
ro.source(source_options().filters(map));

I get no messages back and eventually this error:

com.microsoft:timeout: The operation did not complete within the allocated time 
00:01:00 for object attach.

If I apply no filter, I do get the unfiltered message stream to appear. I have been able to get the filter to work with similar javascript code in nodejs using noodlefrenzy's amqp10 library. Any help on how to get my qpid code to work would be appreciated.

New note: per Xin Chen's reply, I replaced the line above

    << proton::binary("amqp.annotation.x-opt-offset > '100'")

with

    << "amqp.annotation.x-opt-offset > 100"

And this seems to work.

Greg Clinton
  • 365
  • 1
  • 7
  • 18
  • 1
    The filter value needs to be a string. There might be an issue with the proton::binary value you put in. – Xin Chen May 24 '17 at 18:18
  • Yes, that worked, @Xin. Thank you very much. Removing proton::binary from the code above fixed my problem. Maybe you can post as answer. I used qpid's selected_recv.cpp example code where they did use binary, but apparently azure event hub, does it differently. – Greg Clinton May 25 '17 at 20:22
  • @GregClinton You could also edit and write the corrected code. If you removed binary, then how did you pass the condition? – Mert Mertce Sep 19 '17 at 07:32

1 Answers1

1

The Azure Event Hubs uses a described string as a filter to specify start position. The descriptor is a symbol "apache.org:selector-filter:string" and the value is a string. More details can be found in this page: https://github.com/Azure/amqpnetlite/blob/master/docs/articles/azure_eventhubs.md

Xin Chen
  • 496
  • 2
  • 3
  • So how would you pass such a selector to qpid? Setting a selector like: amqp.annotation.x-opt-offset > 1 and passing it as selector to create a consumer, doesn't seem to work. consumer = session.createConsumer(queue, selector); – Ekkelenkamp Mar 23 '20 at 19:53