You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by je...@apache.org on 2019/04/12 18:51:41 UTC

[pulsar] branch master updated: Add steps to build Pulsar function to docs. (#4034)

This is an automated email from the ASF dual-hosted git repository.

jerrypeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 6983359  Add steps to build Pulsar function to docs. (#4034)
6983359 is described below

commit 6983359a4aaf37f61a18d6b0449de85c4eb4e19d
Author: Fangbin Sun <su...@gmail.com>
AuthorDate: Sat Apr 13 02:51:35 2019 +0800

    Add steps to build Pulsar function to docs. (#4034)
---
 site2/docs/functions-overview.md | 11 ++++++-----
 site2/docs/io-develop.md         | 14 +++++++-------
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/site2/docs/functions-overview.md b/site2/docs/functions-overview.md
index d033296..c70d4d0 100644
--- a/site2/docs/functions-overview.md
+++ b/site2/docs/functions-overview.md
@@ -69,7 +69,7 @@ If you were to implement the classic word count example using Pulsar Functions,
 
 ![Pulsar Functions word count example](assets/pulsar-functions-word-count.png)
 
-If you were writing the function in [Java](functions-api.md#functions-for-java) using the [Pulsar Functions SDK for Java](functions-api.md#java-sdk-functions), you could write the function like this...
+If you were writing the function in [Java](functions-api.md#functions-for-java) using the [Pulsar Functions SDK for Java](functions-api.md#java-sdk-functions), you could write the function like below:
 
 ```java
 package org.example.functions;
@@ -82,17 +82,18 @@ import java.util.Arrays;
 public class WordCountFunction implements Function<String, Void> {
     // This function is invoked every time a message is published to the input topic
     @Override
-    public Void process(String input, Context context) {
+    public Void process(String input, Context context) throws Exception {
         Arrays.asList(input.split(" ")).forEach(word -> {
             String counterKey = word.toLowerCase();
-            context.incrCounter(counterKey, 1)
+            context.incrCounter(counterKey, 1);
         });
         return null;
     }
 }
 ```
 
-...and then [deploy it](#cluster-run-mode) in your Pulsar cluster using the [command line](#command-line-interface) like this:
+Next, you need to bundle and build the jar file to be deployed, the approaches can be found in ["Creating an Uber JAR"](#creating-an-uber-jar) and ["Creating a NAR package"](#creating-a-nar-package).
+Then [deploy it](#cluster-run-mode) in your Pulsar cluster using the [command line](#command-line-interface) like below:
 
 ```bash
 $ bin/pulsar-admin functions create \
@@ -144,7 +145,7 @@ class RoutingFunction(Function):
 Pulsar Functions are managed using the [`pulsar-admin`](reference-pulsar-admin.md) CLI tool (in particular the [`functions`](reference-pulsar-admin.md#functions) command). Here's an example command that would run a function in [local run mode](#local-run-mode):
 
 ```bash
-$ bin/pulsar-functions localrun \
+$ bin/pulsar-admin functions localrun \
   --inputs persistent://public/default/test_src \
   --output persistent://public/default/test_result \
   --jar examples/api-examples.jar \
diff --git a/site2/docs/io-develop.md b/site2/docs/io-develop.md
index 72a75b8..828281f 100644
--- a/site2/docs/io-develop.md
+++ b/site2/docs/io-develop.md
@@ -182,14 +182,14 @@ You can use [maven-shade-plugin](https://maven.apache.org/plugins/maven-shade-pl
       <goals>
         <goal>shade</goal>
       </goals>
+      <configuration>
+        <filters>
+          <filter>
+            <artifact>*:*</artifact>
+          </filter>
+        </filters>
+      </configuration>
     </execution>
-    <configuration>
-      <filters>
-        <filter>
-          <artifact>*:*</artifact>
-        </filter>
-      </filters>
-    </configuration>
   </executions>
 </plugin>
 ```