Comments (12)
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.
Thank you grs for guiding me on this line.
from rhea.
One more question, How to pass multiple filters ? to selector function any sample snippet ?
from rhea.
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.
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...
-
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.
-
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,
- Am i missing something when used with Map route ?
- How to configure multiple filters from map to make it work ?
from rhea.
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.
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
- Multiple filters with single selector function only.
- not able to filter non application_properties filters.
any inputs for multiple filters and non application_properties filters
from rhea.
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.
let me try appending amqp then will update you.
from rhea.
using filter like amqp.first_acquirer is not helping us.
from rhea.
I would suggest asking the support for the broker you are using what they recommend for your use case.
from rhea.
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)
- Regression in PR #382: Handle transfer with no payload HOT 1
- Receiver (Consumer) does not receive message that are larger than ~4.15kb HOT 3
- How can I access virtual host using rhea with TLS? HOT 13
- Does it supports OAUTH2 mechanism? HOT 2
- ulong correlation_id incorrecly serialized as uuid HOT 3
- Acknowledgments doesnt work HOT 6
- idle_time_out fires which event? HOT 15
- Publish Window Size Property HOT 2
- `NetClientConnectionOptions` and `TlsClientConnectionOptions` should be exported
- Wildcard Topics HOT 15
- loosing messages intermittently while consuming from Azure service bus HOT 1
- Is `absolute_expiry_time` in milliseconds? HOT 7
- amqp:resource-limit-exceeded ERROR HOT 1
- `sendable` event not fired after certain amount of messages HOT 1
- Regenerate or remove ssl certificates for examples
- Connection RabbitMQ through websocket HOT 2
- Sender appears to be ignoring max_frame_size HOT 4
- connection_detail does not support hostname HOT 5
- Issue and question - Detached receivers / draining credits HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rhea.