pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] yumochiz opened a new pull request #2270: Fix the sample code in Metrics for Pulsar Functions document
Date Tue, 31 Jul 2018 04:17:57 GMT
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message