hzh0425 opened a new issue, #18483:
URL: https://github.com/apache/pulsar/issues/18483

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) 
and found nothing similar.
   
   
   ### Motivation
   
   Currently, Pulsar uses the pluggable EntryFilter method for message 
filtering based on https://github.com/apache/pulsar/issues/12269. Users need to 
implement EntryFilter by themselves, and then filter messages on the broker 
side.
   This way will require many tedious steps, as shown in the documentation 
https://github.com/apache/pulsar/blob/master/site2/docs/develop-plugin.md.
   
   We hope to introduce a more convenient way to filter messages through sql. 
Consumers can implement automatic filtering on the broker side through simple 
subscriptions without implementing EntryFilter.
   E.g, 
   
   We have the following message, which has two properties:
   ```
   producer. newMessage()
                       .value(messageValue)
                       .property("country", "cn")
                       .property("age", "30")
                       .send();
   ```
   On the consumer side, we want to filter messages through sql:
   ```
    ConsumerBuilder<String> builder = client. newConsumer(Schema. STRING)
                   .topic(topicName)
                   .subscriptionName(randomName(8))
                   .subscriptionType(SubscriptionType. Exclusive);
   
   builder.subscriptBySql("name IS NOT NULL AND age IS NOT NULL AND country == 
'cn' AND age >= 30 ")
   
   ```
   
   ### Solution
   
   We need to implement a sql filtering mechanism on the broker side, that is, 
an EntryFilter that can support sql.
   This way, users don't need to write EntryFilter themselves.
   
   ### Alternatives
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to