This documentation is for an unreleased version of Apache Flink Stateful Functions. We recommend you use the latest stable version.

Application Modules #

An application module consists of multiple components that take part in a StateFun application. It includes the endpoints where the runtime can reach functions, along with ingress and egress definitions.

Modules are defined using a YAML file. For example, below is a module that defines an HTTP function endpoint as well as a Kafka ingress and egress:

kind: io.statefun.endpoints.v2/http
  functions: com.example/*
  urlPathTemplate: https://bar.foo.com/{function.name}
kind: io.statefun.kafka.v1/ingress
  id: com.example/my-ingress
  address: kafka-broker:9092
  consumerGroupId: my-consumer-group
    - topic: message-topic
      valueType: io.statefun.types/string
        - com.example/greeter
kind: io.statefun.kafka.v1/egress
  id: com.example/my-egress
  address: kafka-broker:9092
    type: exactly-once
    transactionTimeout: 15min

A module YAML file can contain multiple YAML documents, separated by ---, each representing a component to be included in the application. Each component is defined by a kind typename string and a spec object containing the component’s properties.