You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by wi...@apache.org on 2020/08/02 08:11:48 UTC
[incubator-streampipes] branch dev updated: updates to python
wrapper README
This is an automated email from the ASF dual-hosted git repository.
wiener pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new 86a7c35 updates to python wrapper README
86a7c35 is described below
commit 86a7c35ed314d0e473a907932b51792069fd8381
Author: Patrick Wiener <wi...@fzi.de>
AuthorDate: Sun Aug 2 10:11:33 2020 +0200
updates to python wrapper README
---
streampipes-wrapper-python/README.md | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/streampipes-wrapper-python/README.md b/streampipes-wrapper-python/README.md
index e64fffb..d77ce90 100644
--- a/streampipes-wrapper-python/README.md
+++ b/streampipes-wrapper-python/README.md
@@ -42,17 +42,44 @@ class HelloWorldProcessor(EventProcessor):
This processor received an event `dict` and adds a new `greeting` field including the message `hello world` to it.
#### Add to processor dict
````
-from streampipes.core import StandaloneSubmitter
+from streampipes.core import StandaloneModelSubmitter
from streampipes.manager import Declarer
+from streampipes.model.pipeline_element_config import Config
+
+from helloworld import HelloWorldProcessor
def main():
+ # Configurations to be stored in key-value store (consul)
+ config = Config(app_id='pe/org.apache.streampipes.processor.python')
+
+ config.register(type='host',
+ env_key='SP_HOST',
+ default='processor-python',
+ description='processor hostname')
+
+ config.register(type='port',
+ env_key='SP_PORT',
+ default=8090,
+ description='processor port')
+
+ config.register(type='service',
+ env_key='SP_SERVICE_NAME',
+ default='Python Processor',
+ description='processor service name')
+
processors = {
'org.apache.streampipes.processors.python.helloworld': HelloWorldProcessor,
}
+ # Declarer
+ # add the dict of processors to the Declarer
+ # This is an abstract class that holds the specified processors
Declarer.add(processors=processors)
- StandaloneSubmitter.init()
+
+ # StandaloneModelSubmitter
+ # Initializes the REST api
+ StandaloneModelSubmitter.init(config=config)
if __name__ == '__main__':