You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tz...@apache.org on 2020/03/24 04:27:02 UTC
[flink-statefun] 03/04: [hotfix] [py] Rename kafka_egress_builder
to kafka_egress_record
This is an automated email from the ASF dual-hosted git repository.
tzulitai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-statefun.git
commit b92f6d16e38e952f7e70a472fe3e075da0385fdb
Author: Tzu-Li (Gordon) Tai <tz...@apache.org>
AuthorDate: Tue Mar 24 12:21:02 2020 +0800
[hotfix] [py] Rename kafka_egress_builder to kafka_egress_record
Renamed since the method doesn't create a builder, but a record
directly.
---
statefun-examples/statefun-python-k8s/main.py | 4 ++--
statefun-python-sdk/statefun/__init__.py | 2 +-
statefun-python-sdk/statefun/core.py | 2 +-
statefun-python-sdk/tests/request_reply_test.py | 6 +++---
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/statefun-examples/statefun-python-k8s/main.py b/statefun-examples/statefun-python-k8s/main.py
index 6867dd8..67d3fce 100644
--- a/statefun-examples/statefun-python-k8s/main.py
+++ b/statefun-examples/statefun-python-k8s/main.py
@@ -21,7 +21,7 @@ from messages_pb2 import SeenCount
from statefun import StatefulFunctions
from statefun import RequestReplyHandler
-from statefun import kafka_egress_builder
+from statefun import kafka_egress_record
functions = StatefulFunctions()
@@ -36,7 +36,7 @@ def greet(context, message: LoginEvent):
state.seen += 1
context.state('seen_count').pack(state)
- egress_message = kafka_egress_builder(topic="seen", key=message.user_name, value=state)
+ egress_message = kafka_egress_record(topic="seen", key=message.user_name, value=state)
context.pack_and_send_egress("k8s-demo/greets-egress", egress_message)
diff --git a/statefun-python-sdk/statefun/__init__.py b/statefun-python-sdk/statefun/__init__.py
index cbde207..c0268fa 100644
--- a/statefun-python-sdk/statefun/__init__.py
+++ b/statefun-python-sdk/statefun/__init__.py
@@ -19,4 +19,4 @@
from statefun.core import StatefulFunctions
from statefun.request_reply import RequestReplyHandler
-from statefun.core import kafka_egress_builder
\ No newline at end of file
+from statefun.core import kafka_egress_record
\ No newline at end of file
diff --git a/statefun-python-sdk/statefun/core.py b/statefun-python-sdk/statefun/core.py
index e962c6f..0a80e94 100644
--- a/statefun-python-sdk/statefun/core.py
+++ b/statefun-python-sdk/statefun/core.py
@@ -189,7 +189,7 @@ class StatefulFunctions:
return self.functions[(namespace, type)]
-def kafka_egress_builder(topic: str, value, key: str = None):
+def kafka_egress_record(topic: str, value, key: str = None):
"""
Build a ProtobufMessage that can be emitted to a Protobuf based egress.
diff --git a/statefun-python-sdk/tests/request_reply_test.py b/statefun-python-sdk/tests/request_reply_test.py
index 6c80d00..3e7437a 100644
--- a/statefun-python-sdk/tests/request_reply_test.py
+++ b/statefun-python-sdk/tests/request_reply_test.py
@@ -25,7 +25,7 @@ from google.protobuf.any_pb2 import Any
from tests.examples_pb2 import LoginEvent, SeenCount
from statefun.request_reply_pb2 import ToFunction, FromFunction
from statefun import RequestReplyHandler
-from statefun.core import StatefulFunctions, kafka_egress_builder
+from statefun.core import StatefulFunctions, kafka_egress_record
class InvocationBuilder(object):
@@ -126,9 +126,9 @@ class RequestReplyTestCase(unittest.TestCase):
# kafka egress
context.pack_and_send_egress("sdk/kafka",
- kafka_egress_builder(topic="hello", key=u"hello world", value=seen))
+ kafka_egress_record(topic="hello", key=u"hello world", value=seen))
context.pack_and_send_egress("sdk/kafka",
- kafka_egress_builder(topic="hello", value=seen))
+ kafka_egress_record(topic="hello", value=seen))
#
# build the invocation