Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the sample code in Metrics for Pulsar Functions document #2270

Merged
merged 1 commit into from
Jul 31, 2018

Conversation

yumochiz
Copy link
Contributor

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.

@nkurihar
Copy link
Contributor

run cpp tests

@nkurihar
Copy link
Contributor

run integration tests

@nkurihar
Copy link
Contributor

run cpp tests

@nkurihar nkurihar added the doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. label Jul 31, 2018
@nkurihar nkurihar merged commit 5ebd4f5 into apache:master Jul 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Your PR contains doc changes, no matter whether the changes are in markdown or code files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants