authors:
Stateful Functions is a cross-platform stack for building Stateful Serverless applications, making it radically simpler to develop scalable, consistent, and elastic distributed applications. This new release brings various improvements to the StateFun runtime, a leaner way to specify StateFun module components, and a brand new JavaScript SDK!
The binary distribution and source artifacts are now available on the updated Downloads page of the Flink website, and the most recent Java SDK, Python SDK,, GoLang SDK and JavaScript SDK distributions are available on Maven, PyPI, Github, and npm respectively. You can also find official StateFun Docker images of the new version on Dockerhub.
For more details, check the complete release changelog and the [updated documentation]({{< param DocsBaseUrl >}}flink-statefun-docs-release-3.2/). We encourage you to download the release and share your feedback with the community through the Flink mailing lists or JIRA!
Stateful Functions provides a unified model for building stateful applications across various programming languages and deployment environments. The community is thrilled to release an official JavaScript SDK as part of the 3.2.0 release.
const http = require("http"); const {messageBuilder, StateFun, Context} = require("apache-flink-statefun"); let statefun = new StateFun(); statefun.bind({ typename: "com.example.fns/greeter", fn(context, message) { const name = message.asString(); let seen = context.storage.seen || 0; seen = seen + 1; context.storage.seen = seen; context.send( messageBuilder({typename: 'com.example.fns/inbox', id: name, value: `"Hello ${name} for the ${seen}th time!"`}) ); }, specs: [{ name: "seen", type: StateFun.intType(), }] }); http.createServer(statefun.handler()).listen(8000);
As with the Python, Java and Go SDKs, the JavaScript SDK includes:
ValueSpec to describe the state name, type, and possibly expiration configuration at runtime.You can get started by adding the SDK to your project.
npm install apache-flink-statefun@3.2.0
For a detailed SDK tutorial, we would like to encourage you to visit:
With the newly introduced configuration option statefun.remote.module-name, it is possible to override the default remote module file name (module.yaml).
To provide a different name, for example prod.yaml that is located at /flink/usrlib/prod.yaml, one can add the following to ones flink-conf.yaml:
statefun.remote.module-name: /flink/usrlib/prod.yaml
For more information see FLINK-25308.
The embedded SDK now supports registering custom counters. For more information see FLINK-22533.
Stateful Functions 3.2.0 runtime uses Flink 1.14.3 underneath. This means that Stateful Functions benefits from the latest improvements and stabilisations that went into Flink. For more information see Flink's release announcement.
Please review the release notes for a detailed list of changes and new features if you plan to upgrade your setup to Stateful Functions 3.2.0.
Seth Wiesman, Igal Shilman, Till Rohrmann, Stephan Ewen, Tzu-Li (Gordon) Tai, Ingo Bürk, Evans Ye, neoXfire, Galen Warren
If you’d like to get involved, we’re always looking for new contributors.