GithubHelp home page GithubHelp logo

Comments (12)

grs avatar grs commented on August 16, 2024

The filters are actually handled by the broker. The client merely passes them through. The specification allows for use of other message properties as well as application properties. The filter can only be set on opening a receiver. If you need to change it you will need to close the original receiver and create a new one.

from rhea.

suryalokhande avatar suryalokhande commented on August 16, 2024

Thank you grs for guiding me on this line.

from rhea.

suryalokhande avatar suryalokhande commented on August 16, 2024

One more question, How to pass multiple filters ? to selector function any sample snippet ?

from rhea.

grs avatar grs commented on August 16, 2024

Whether a broker supports multiple filters on the same link will be a question for the particular broker. However the selector can combine multiple terms, so that may be sufficient.

As to the mechanism in the client, you just need to pass a map as the value for filters and that can contain multiple entries if supported by the broker.

from rhea.

suryalokhande avatar suryalokhande commented on August 16, 2024

Thank grs for your quick turnaround.
Yes in my case broker support multiple filters,

have spent some time to configure filters from map way
let me set context...

  1. filter set by inline case
    here am interested in to process messages that has cluster_version with value '9.13.0' in application_properties
    filter:filter.selector("cluster_version='9.13.0'")
    i.e message as below
    Message {
    ---
    application_properties: {
    -----
    cluster_version: '9.13.0'
    },
    }

    Can see the my sample application recieves message, as it has cluster_version: '9.13.0 in it and filter is working fine.

  2. filter set by map case,
    am setting 'cluster_version' value as 9.13.1 as below...

const filtersMap = {};
here, now am interested in to process messages only that has cluster_version with value 9.13.1
filtersMap['cluster_version']='9.13.1';
filter:filter.selector(filtersMap)

now, am passing message that has cluster_version value as 9.13.0 to my topic.
my sample application still receives this message, even cluster_version value as 9.13.0

am expecting
my application should be not receive messages, when cluster_version value is 9.13.0
as have configured from filters am interested in 9.13.1 only, why my application received message for 9.13.0 ?

my questions,

  1. Am i missing something when used with Map route ?
  2. How to configure multiple filters from map to make it work ?

from rhea.

grs avatar grs commented on August 16, 2024

The return value of filters.selector() is a map. You can add other filters into that map (as long as they are correctly formatted according o the specification of the filter. Obviously you can't set multiple different selector filters on the same receiver, though the single selector can have multiple terms.

from rhea.

suryalokhande avatar suryalokhande commented on August 16, 2024

Thank you grs,

if my message from amqp topic, which am listening to.

Message {
durable: false,
priority: 4,
first_acquirer: true,
to: 'data',
creation_time: 2023-05-04T22:03:24.478Z,
application_properties: {
cluster_uuid: '31baa6b7-e479',
cluster_version: '9.13.0'
},
body: "{Hello}"
}

either this works
filter:filter.selector("cluster_version='9.13.0'"),
or
filter:filter.selector("cluster_uuid='31baa6b7-e479'"),

but if when use
filter:filter.selector("first_acquirer='true'"), <-- does not as it's attribute of message not member of application_properties's attributes.

but when i used selector values with comma or space separated fails...
filter:filters.selector("cluster_version='9.13.0' , volume_name='A'") // Comma separated
or
filter:filters.selector("cluster_version='9.13.0' x='10'") // Space separated

Two use case not able make it work, is

  1. Multiple filters with single selector function only.
  2. not able to filter non application_properties filters.

any inputs for multiple filters and non application_properties filters

from rhea.

grs avatar grs commented on August 16, 2024

For message properties, you need to prefix them with amqp.. I am not sure if amqp.first_acquirer will be recognised (amqp.delivery_count > 0 might be an alternative check if not. The details of the filter are defined here: https://svn.apache.org/repos/asf/qpid/trunk/qpid/specs/apache-filters.xml#type-selector-filter though that mostly delegates to the specification of JMS selectors.

To combine terms, use AND e.g. "cluster_version='9.13.0' AND volume_name='A'"

from rhea.

suryalokhande avatar suryalokhande commented on August 16, 2024

let me try appending amqp then will update you.

from rhea.

suryalokhande avatar suryalokhande commented on August 16, 2024

using filter like amqp.first_acquirer is not helping us.

from rhea.

grs avatar grs commented on August 16, 2024

I would suggest asking the support for the broker you are using what they recommend for your use case.

from rhea.

suryalokhande avatar suryalokhande commented on August 16, 2024

sure, let me reach up with my backend team and collect data on broker side. thanks a lot for your support.

from rhea.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.