forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More Pulsar Functions documentation (apache#1362)
* add note on multiple input topics * fix CSS for highlight blocks * more java API docs * fix scrolling issue * add CLI documentation for pulsar-admin functions * fix YAML issues * add PF to features list on front page * add note about SPEs to feature description * remove unnecessary include in local config * add new badges to templates * add section on core programming modeL * add section on the SDK * begin adding section on java sdk * comparison table for native vs SDK * add decrementCounter method * add link * add counters section * update example functions * revert Context object to master * add user config section for java * fix misspelling in error output * add new PF config to YAML descriptor * add processing guarantees doc to the sidebar * update download URL and add trigger command to CLI docs * add logTopic flag to CLI docs * use native python function in quickstart * add intro to java section * update example functions and finish draft of API doc * fix URL in sidebar config * finish user config section in API doc * add example ContextFunction * finish draft of processing guarantees doc * add section on triggering * comment out subscription types section for now * remove unnecessary console.log statement * remove <hr> in docs template * add missing DefaultSerDe class import * fix error output to match test expectation * Add missing license header to new example Pulsar Function
- Loading branch information
1 parent
a2cf918
commit 5f1aed2
Showing
35 changed files
with
946 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...java-examples/src/main/java/org/apache/pulsar/functions/api/examples/ContextFunction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.pulsar.functions.api.examples; | ||
|
||
import org.apache.pulsar.functions.api.Context; | ||
import org.apache.pulsar.functions.api.Function; | ||
import org.slf4j.Logger; | ||
|
||
import java.util.stream.Collectors; | ||
|
||
public class ContextFunction implements Function<String, Void> { | ||
@Override | ||
public Void process(String input, Context context) { | ||
Logger LOG = context.getLogger(); | ||
String inputTopics = context.getInputTopics().stream().collect(Collectors.joining(", ")); | ||
String functionName = context.getFunctionName(); | ||
|
||
String logMessage = String.format("A message with a value of \"%s\" has arrived on one of the following topics: %s\n", | ||
input, | ||
inputTopics); | ||
|
||
LOG.info(logMessage); | ||
|
||
String metricName = String.format("function-%s-messages-received", functionName); | ||
context.recordMetric(metricName, 1); | ||
|
||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,4 @@ | |
source 'https://rubygems.org' | ||
ruby '2.3.1' | ||
|
||
gem 'jekyll', '3.7.0' | ||
gem 'jekyll', '3.7.3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,5 +19,3 @@ | |
|
||
destination: generated | ||
baseurl: "" | ||
include: | ||
- docs/example.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.