You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tr...@apache.org on 2022/02/15 09:17:42 UTC

[flink-statefun] branch release-3.2 updated (c45cf00 -> 481f98f)

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

trohrmann pushed a change to branch release-3.2
in repository https://gitbox.apache.org/repos/asf/flink-statefun.git.


    from c45cf00  [FLINK-25915][docs] Add Matomo tracking code to base layout
     new 345f744  [FLINK-25898] Add README.md to statefun-sdk-js
     new 231ec1a  [hotfix] Let Python README.md point to Statefun playground
     new 481f98f  [hotfix] Update README.md links to point to release-3.2 playground version

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 README.md                                          |   8 +-
 {statefun-sdk-python => statefun-sdk-js}/README.md | 107 ++++++++-------------
 statefun-sdk-python/README.md                      |  10 +-
 3 files changed, 51 insertions(+), 74 deletions(-)
 copy {statefun-sdk-python => statefun-sdk-js}/README.md (63%)
 mode change 100755 => 100644

[flink-statefun] 01/03: [FLINK-25898] Add README.md to statefun-sdk-js

Posted by tr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

trohrmann pushed a commit to branch release-3.2
in repository https://gitbox.apache.org/repos/asf/flink-statefun.git

commit 345f7440a71efaa6d54ddd2ea7c2d4683c8ad35b
Author: Till Rohrmann <tr...@apache.org>
AuthorDate: Thu Feb 10 18:10:07 2022 +0100

    [FLINK-25898] Add README.md to statefun-sdk-js
    
    This closes #301.
---
 statefun-sdk-js/README.md | 119 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 119 insertions(+)

diff --git a/statefun-sdk-js/README.md b/statefun-sdk-js/README.md
new file mode 100644
index 0000000..01640c9
--- /dev/null
+++ b/statefun-sdk-js/README.md
@@ -0,0 +1,119 @@
+# Apache Flink Stateful Functions
+
+Stateful Functions is an API that simplifies the building of **distributed stateful applications** with a **runtime built for serverless architectures**.
+It brings together the benefits of stateful stream processing - the processing of large datasets with low latency and bounded resource constraints -
+along with a runtime for modeling stateful entities that supports location transparency, concurrency, scaling, and resiliency.
+
+<img alt="Stateful Functions Architecture" width="80%" src="https://github.com/apache/flink-statefun/blob/master/docs/fig/concepts/arch_overview.svg">
+
+It is designed to work with modern architectures, like cloud-native deployments and popular event-driven FaaS platforms
+like AWS Lambda and KNative, and to provide out-of-the-box consistent state and messaging while preserving the serverless
+experience and elasticity of these platforms.
+
+Stateful Functions is developed under the umbrella of [Apache Flink](https://flink.apache.org/).
+
+This README is meant as a brief walkthrough on the StateFun JavaScript SDK for NodeJS and how to set things up
+to get yourself started with Stateful Functions in JavaScript.
+
+For a fully detailed documentation, please visit the [official docs](https://ci.apache.org/projects/flink/flink-statefun-docs-master).
+
+For code examples, please take a look at the [examples](https://github.com/apache/flink-statefun-playground/tree/release-3.2/javascript).
+
+## Table of Contents
+
+- [JavaScript SDK for NodeJS Overview](#sdkoverview)
+- [Contributing](#contributing)
+- [License](#license)
+
+## <a name="sdkoverview"></a> JavaScript SDK for NodeJS Overview
+
+### Background
+
+The JVM-based Stateful Functions implementation has a `RequestReply` extension (a protocol and an implementation) that allows calling into any HTTP endpoint that implements that protocol. Although it is possible to implement this protocol independently, this is a minimal library for the JavaScript programing language that:
+
+* Allows users to define and declare their functions in a convenient way.
+
+* Dispatches an invocation request sent from the JVM to the appropriate function previously declared.
+
+### A Mini-Tutorial
+
+#### Define and Declare a Function
+
+```
+const {Context, Message, StateFun} = require("apache-flink-statefun");
+
+let statefun = new StateFun();
+statefun.bind({
+	typename: "example/greeter",
+	fn(context, message) {
+    console.log("Hey %s!", message.asString())
+  }
+});
+```
+
+This code declares a function with of type `example/greeter` and binds it to the instance.
+
+#### Registering and accessing persisted state
+
+You can register persistent state that will be managed by the Stateful Functions workers
+for state consistency and fault-tolerance. Values can be generally obtained via the context parameter:
+
+```
+const {Context, Message, StateFun} = require("apache-flink-statefun");
+
+let statefun = new StateFun();
+statefun.bind({
+    typename: "example/greeter",
+    fn(context, message) {
+        const name = message.asString();
+        let seen = context.storage.seen || 0;
+        seen = seen + 1;
+        context.storage.seen = seen;
+
+        console.log("Hello %s for the %dth time!", name, seen);
+    },
+    specs: [{
+        name: "seen",
+        type: StateFun.intType(),
+    }]
+});
+```
+
+#### Exposing the Request Reply Handler
+
+```
+const http = require("http");
+const {Context, Message, StateFun} = require("apache-flink-statefun");
+
+let statefun = new StateFun();
+//...
+
+http.createServer(statefun.handler()).listen(8000);
+```
+
+This creates an HTTP server that accepts requests from the Stateful Functions cluster and
+dispatches it to the handler.
+
+#### Composing the Module YAML File
+
+The remaining step would be to declare this function type in a module.yaml
+
+```
+functions:
+  - function:
+    meta:
+      kind: http
+      type: demo/greeter
+    spec:
+      endpoint: http://<end point url>/statefun
+```
+
+## <a name="contributing"></a>Contributing
+
+There are multiple ways to enhance the Stateful Functions API for different types of applications; the runtime and operations will also evolve with the developments in Apache Flink.
+
+You can learn more about how to contribute in the [Apache Flink website](https://flink.apache.org/contributing/how-to-contribute.html). For code contributions, please read carefully the [Contributing Code](https://flink.apache.org/contributing/contribute-code.html) section and check the _Stateful Functions_ component in [Jira](https://issues.apache.org/jira/browse/FLINK-15969?jql=project%20%3D%20FLINK%20AND%20component%20%3D%20%22Stateful%20Functions%22) for an overview of ongoing commun [...]
+
+## <a name="license"></a>License
+
+The code in this repository is licensed under the [Apache Software License 2](LICENSE).

[flink-statefun] 02/03: [hotfix] Let Python README.md point to Statefun playground

Posted by tr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

trohrmann pushed a commit to branch release-3.2
in repository https://gitbox.apache.org/repos/asf/flink-statefun.git

commit 231ec1ac45b2562c12ded19aad4a8bf29c256ba2
Author: Till Rohrmann <tr...@apache.org>
AuthorDate: Thu Feb 10 18:13:23 2022 +0100

    [hotfix] Let Python README.md point to Statefun playground
---
 statefun-sdk-python/README.md | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/statefun-sdk-python/README.md b/statefun-sdk-python/README.md
index 286060a..4856ed3 100755
--- a/statefun-sdk-python/README.md
+++ b/statefun-sdk-python/README.md
@@ -2,11 +2,11 @@
 
 Stateful Functions is an API that simplifies the building of **distributed stateful applications** with a **runtime built for serverless architectures**.
 It brings together the benefits of stateful stream processing - the processing of large datasets with low latency and bounded resource constraints -
-along with a runtime for modeling stateful entities that supports location transparency, concurrency, scaling, and resiliency. 
+along with a runtime for modeling stateful entities that supports location transparency, concurrency, scaling, and resiliency.
 
 <img alt="Stateful Functions Architecture" width="80%" src="https://github.com/apache/flink-statefun/blob/master/docs/fig/concepts/arch_overview.svg">
 
-It is designed to work with modern architectures, like cloud-native deployments and popular event-driven FaaS platforms 
+It is designed to work with modern architectures, like cloud-native deployments and popular event-driven FaaS platforms
 like AWS Lambda and KNative, and to provide out-of-the-box consistent state and messaging while preserving the serverless
 experience and elasticity of these platforms.
 
@@ -17,7 +17,7 @@ to get yourself started with Stateful Functions in Python.
 
 For a fully detailed documentation, please visit the [official docs](https://ci.apache.org/projects/flink/flink-statefun-docs-master).
 
-For code examples, please take a look at the [examples](../statefun-examples/).
+For code examples, please take a look at the [examples](https://github.com/apache/flink-statefun-playground/tree/release-3.2/python).
 
 ## Table of Contents
 
@@ -57,7 +57,7 @@ You can register persistent state that will be managed by the Stateful Functions
 for state consistency and fault-tolerance. Values can be generally obtained via the context parameter:
 
 ```
-from statefun import * 
+from statefun import *
 
 functions = StatefulFunctions()
 
@@ -81,7 +81,7 @@ handler = RequestReplyHandler(functions)
 
 For example, using Flask:
 
-``` 
+```
 @app.route('/statefun', methods=['POST'])
 def handle():
     response_data = handler.handle_sync(request.data)

[flink-statefun] 03/03: [hotfix] Update README.md links to point to release-3.2 playground version

Posted by tr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

trohrmann pushed a commit to branch release-3.2
in repository https://gitbox.apache.org/repos/asf/flink-statefun.git

commit 481f98ff02126a2cc0ee4fc447d09d388d266085
Author: Till Rohrmann <tr...@apache.org>
AuthorDate: Tue Feb 15 09:53:51 2022 +0100

    [hotfix] Update README.md links to point to release-3.2 playground version
---
 README.md | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 89cf345..e15532b 100755
--- a/README.md
+++ b/README.md
@@ -116,21 +116,21 @@ We highly recommend starting from the the tutorials and examples that can be fou
 
 ### <a name="java">New Java Users
 
-Head over to the [Java SDK Showcase](https://github.com/apache/flink-statefun-playground/tree/release-3.0/java/showcase), or the [Java Greeter Example](https://github.com/apache/flink-statefun-playground/tree/release-3.0/java/greeter) in the playground repository.
+Head over to the [Java SDK Showcase](https://github.com/apache/flink-statefun-playground/tree/release-3.2/java/showcase), or the [Java Greeter Example](https://github.com/apache/flink-statefun-playground/tree/release-3.2/java/greeter) in the playground repository.
 
 Alternatively, execute the following commands to clone the playground repository locally:
 ```
-$ git clone -b release-3.0 https://github.com/apache/flink-statefun-playground.git
+$ git clone -b release-3.2 https://github.com/apache/flink-statefun-playground.git
 $ cd java/showcase # or, java/greeter
 ```
 
 ### <a name="python">New Python Users
 
-For new Python users, head over to the [Python SDK Showcase](https://github.com/apache/flink-statefun-playground/tree/release-3.0/python/showcase), or the [Python Greeter Example](https://github.com/apache/flink-statefun-playground/tree/release-3.0/python/greeter) in the playground repository.
+For new Python users, head over to the [Python SDK Showcase](https://github.com/apache/flink-statefun-playground/tree/release-3.2/python/showcase), or the [Python Greeter Example](https://github.com/apache/flink-statefun-playground/tree/release-3.2/python/greeter) in the playground repository.
 
 Alternatively, execute the following commands to clone the playground repository locally:
 ```
-$ git clone -b release-3.0 https://github.com/apache/flink-statefun-playground.git
+$ git clone -b release-3.2 https://github.com/apache/flink-statefun-playground.git
 $ cd python/showcase # or, python/greeter
 ```