You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2018/03/24 04:22:52 UTC
[incubator-pulsar] branch master updated: Fix Python example class
name (#1421)
This is an automated email from the ASF dual-hosted git repository.
mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new a4174a5 Fix Python example class name (#1421)
a4174a5 is described below
commit a4174a5bef190ff77e74bebe9e97686d55e2a708
Author: Luc Perkins <lu...@gmail.com>
AuthorDate: Fri Mar 23 21:22:50 2018 -0700
Fix Python example class name (#1421)
* fix python class name
* remove python imports
* fix python example script
* change num-msgs flag value to 1
---
pulsar-functions/submit-python-function.sh | 8 +++-----
site/docs/latest/functions/quickstart.md | 20 +++++++-------------
2 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/pulsar-functions/submit-python-function.sh b/pulsar-functions/submit-python-function.sh
index ed625a5..bc2cfbf 100755
--- a/pulsar-functions/submit-python-function.sh
+++ b/pulsar-functions/submit-python-function.sh
@@ -20,9 +20,7 @@
bin/pulsar-functions functions create \
- --function-config conf/example.yml \
- --output-topic persistent://sample/standalone/ns1/test_result \
- --input-topics persistent://sample/standalone/ns1/test_src \
- --output-serde-classname pulsarfunction.serde.IdentitySerDe \
+ --output persistent://sample/standalone/ns1/test_result \
+ --inputs persistent://sample/standalone/ns1/test_src \
--py python-examples/exclamation.py \
- --function-classname exclamation.Exclamation
+ --className exclamation.Exclamation
diff --git a/site/docs/latest/functions/quickstart.md b/site/docs/latest/functions/quickstart.md
index a973ab7..7a0143b 100644
--- a/site/docs/latest/functions/quickstart.md
+++ b/site/docs/latest/functions/quickstart.md
@@ -212,13 +212,7 @@ $ touch reverse.py
In that file, add the following:
```python
-from pulsarfunction import pulsar_function
-
-class Reverse(pulsar_function.PulsarFunction):
- def __init__(self):
- pass
-
- def process(self, input):
+def process(input):
return input[::-1]
```
@@ -227,9 +221,9 @@ Here, the `process` method defines the processing logic of the Pulsar Function.
```bash
$ bin/pulsar-admin functions create \
--py reverse.py \
- --className reverse.Reverse \
- --inputs persistent://sample/standalone/ns1/forwards \
- --output persistent://sample/standalone/ns1/backwards \
+ --className reverse \
+ --inputs persistent://sample/standalone/ns1/input \
+ --output persistent://sample/standalone/ns1/output \
--tenant sample \
--namespace ns1 \
--name reverse
@@ -238,7 +232,7 @@ $ bin/pulsar-admin functions create \
If you see `Created successfully`, the function is ready to accept incoming messages. Let's publish a string to the input topic:
```bash
-$ bin/pulsar-client produce persistent://sample/standalone/ns1/forwards \
+$ bin/pulsar-client produce persistent://sample/standalone/ns1/input \
--num-produce 1 \
--messages "sdrawrof won si tub sdrawkcab saw gnirts sihT"
```
@@ -246,7 +240,7 @@ $ bin/pulsar-client produce persistent://sample/standalone/ns1/forwards \
Now, let's pull in a message from the output topic:
```bash
-$ bin/pulsar-client consume persistent://sample/standalone/ns1/backwards \
+$ bin/pulsar-client consume persistent://sample/standalone/ns1/output \
--subscription-name my-subscription \
--num-messages 1
```
@@ -258,4 +252,4 @@ You should see the reversed string in the log output:
This string was backwards but is now forwards
```
-Once again, success! We created a brand new Pulsar Function, deployed it in our Pulsar standalone cluster, and successfully published to the function's input topic and consumed from its output topic.
\ No newline at end of file
+Once again, success! We created a brand new Pulsar Function, deployed it in our Pulsar standalone cluster, and successfully published to the function's input topic and consumed from its output topic.
--
To stop receiving notification emails like this one, please contact
mmerli@apache.org.