You can quickly get started building a Stateful Functions applications by adding the
stateful-functions-sdk to an existing project or using the provided maven archetype.
<dependency> <groupId>com.ververica</groupId> <artifactId>stateful-functions-sdk</artifactId> <version>1.1-SNAPSHOT</version> <scope>provided</scope> </dependency>
$ mvn archetype:generate \ -DarchetypeGroupId=com.ververica \ -DarchetypeArtifactId=stateful-functions-quickstart \ -DarchetypeVersion=1.1-SNAPSHOT
This allows you to name your newly created project. It will interactively ask you for the groupId, artifactId, and package name. There will be a new directory with the same name as your artifact id.
$ tree stateful-functions-quickstart/ stateful-functions-quickstart/ ├── Dockerfile ├── pom.xml └── src └── main ├── java │ └── com │ └── ververica │ └── statefun │ └── Module.java └── resources └── META-INF └── services └── com.ververica.statefun.sdk.spi.StatefulFunctionModule
The project contains four files:
pom.xml: A pom file with the basic dependencies to start building a Stateful Functions application.
Module: The entry point for the application.
com.ververica.statefun.sdk.spi.StatefulFunctionModule: A service entry for the runtime to find the module.
Dockerfile: A Dockerfile to quickly build a Stateful Functions image ready to deploy.
We recommend you import this project into your IDE to develop and test it. IntelliJ IDEA supports Maven projects out of the box. If you use Eclipse, the m2e plugin allows to import Maven projects. Some Eclipse bundles include that plugin by default, others require you to install it manually.
If you want to build/package your project, go to your project directory and run the
mvn clean package command.
You will find a JAR file that contains your application, plus any libraries that you may have added as dependencies to the application: