The Fn Java FDK helps you build, test and run Java functions on the Fn platform.
The FDK is comprised of:
- a Java library (known as the
api); - a runtime Docker image (known as the
runtime); - a JUnit rule;
- a build-time Docker image for repeatable builds.
Yes - The FDK implements the IO/contract with the FN service and is required to receive events from the platform
Fn Flow is a Java API and corresponding service that helps you create complex, long-running, fault-tolerant functions using a promises-style asynchronous API. Check out the Fn Flow docs for more information.
The FDK is automatically added to your project if you built your function using fn init --runtime=java. The api and testing JARs are published on our maven central repository and the runtime is published in our Docker hub repository.
- Find the latest release from the releases page. For example
1.0.149. - The FDK JAR is published on Maven Central. Add the repository to your
pom.xmlrepositoriessection: - Add the dependency to your
dependencysection. Make sure that theversiontag matches the latest release that you looked up above.
<dependency>
<groupId>com.fnproject.fn</groupId>
<artifactId>api</artifactId>
<version>1.0.32</version>
</dependency>- If you want the JUnit support also add:
<dependency>
<groupId>com.fnproject.fn</groupId>
<artifactId>testing</artifactId>
<version>1.0.32</version>
<scope>test</scope>
</dependency>Have a look on our releases page.
- Find the latest version from our releases page.
- Update the Java
apiversion: change your dependency management system to reference the latest artifact. For example to upgrade a maven build to use1.0.32:
<dependency>
<groupId>com.fnproject.fn</groupId>
<artifactId>api</artifactId>
<version>1.0.32</version>
</dependency>
<dependency>
<groupId>com.fnproject.fn</groupId>
<artifactId>testing</artifactId>
<version>1.0.32</version>
<scope>test</scope>
</dependency>-
Update your runtime image:
- To latest:
docker pull fnproject/fn-java-fdk
- To a specific version:
docker pull fnproject/fn-java-fdk:1.0.32 docker tag fnproject/fn-java-fdk:1.0.32 fnproject/fn-java-fdk:latest
You should keep versions of com.fnproject.fn.api, com.fnproject.fn.testing and your runtime Docker image in sync with each other.
- Update your build image:
docker pull fnproject/fn-java-fdk-buildPlease create an issue on our GitHub repo.
We hang out on the Fn project slack in #fn-flow, #fn-java-fdk.
Please see our Fn Flow User Guide for information on how to get started with Fn Flow in Java.
Use Fn Flow when:
- You want to compose the work of several other Fn functions in a reliable and scalable way.
- You find yourself wanting to write code that blocks on the result of another Fn call.
- You feel tempted to reach for another workflow system or library.
No. java.util.concurrent.Flow is a stream-processing API for running code in a single JVM. Fn Flow is a distributed promise API for writing long-running, fault-tolerant asynchronous functions.
No. Fn Flow was released in 2017 and is not related to any other Java library.
Fn Flow was 'inspired by' the CompletionStage API and shares a number of similar methods. However, as the semantics of Fn Flow are subtly different, and because we require our operations to implement Serializable we have implemented a new API.
Fn Flow is open source just like the rest of the Fn project. You can get the code and run a server easily.