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

   ## Motivation
   
   When we send message by producer, the automatic batching of messages is 
enabled default. This cause the pulsar broker side cannot get the properties of 
the per message in the batch message, when people use the properties to filter 
some message, which will not work well by the [PIP 105: Support pluggable entry 
filter in Dispatcher](https://github.com/apache/pulsar/issues/12269). so this 
case should use the `ConsumerInterceptor`  beforeConsume(Consumer<T> consumer, 
Message<T> message) method implement the filter logic. But the `Consumer` 
interface **cannot get the subscription properties** right now.
   
   ## Goal
   
   Add the `getSubscriptionProperties` method in the Consumer interface to 
expose the subscription  properties.
   
   ## API Changes
   
   org.apache.pulsar.client.api.Consumer
   
   ```java
       /**
        * return The subscription properties
        * @return
        */
       Map<String, String> getSubscriptionProperties();
   ```
   
   ## Implementation
   
   implement  `getSubscriptionProperties()` method in the ConsumerBase abstract 
class.
   
   ```java
       @Override
       public Map<String, String> getSubscriptionProperties() {
           return this.conf.getSubscriptionProperties();
       }
   ```
   
   then the `ConsumerInterceptor` method  `Message<T> beforeConsume(Consumer<T> 
consumer, Message<T> message);` can get the subscription properties.
   
   ## Reject Alternatives
   
   None.
   


-- 
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