yumochiz opened a new pull request #2270: Fix the sample code in Metrics for 
Pulsar Functions document
URL: https://github.com/apache/incubator-pulsar/pull/2270
 
 
   ### Motivation
   In https://pulsar.incubator.apache.org/docs/latest/functions/metrics/
   introducing the sample code of using metric.
   ```
   import org.apache.pulsar.functions.api.Context;
   import org.apache.pulsar.functions.api.Function;
   
   public class MetricRecordingFunction implements Function<String, Void> {
       @Override
       public void apply(String input, Context context) {
           context.recordMetric("number-of-characters", input.length());
           return null;
       }
   }
   ```
   I cannot compile the code because override method is different.
   
   ### Modifications
   
   I changed method `apply` method to `process` method.
   I also change `void` to `Void`.
   
   ```
   @Override
   public Void process(String input, Context context) {
       context.recordMetric("number-of-characters", input.length());
       return null;
   }
   ```
   ### Result
   
   We can compile the code.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to