diff --git a/README.md b/README.md index 961037d..21a9675 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ This project is a community-maintained fork of official Apache Flink Scala API, `flink-scala-api` uses a different package name for all api-related classes like `DataStream`, so you can do gradual migration of a big project and use both upstream and this versions of scala API in the same project. +### API + The actual migration should be straightforward and simple, replace old import to the new ones: ```scala // original api import @@ -24,6 +26,27 @@ import org.apache.flinkx.api._ import org.apache.flinkx.api.serializers._ ``` +### State + +Ensure to replace state descriptor constructors using `Class[T]` param with constructors using `TypeInformation[T]` or `TypeSerializer[T]` param: +```scala mdoc +import org.apache.flink.api.common.state.ValueStateDescriptor +import org.apache.flink.api.common.typeinfo.TypeInformation + +// state using Kryo +val eventStateDescriptor = new ValueStateDescriptor[Option[String]]("event", + classOf[Option[String]]) +``` +```scala mdoc:reset-object +import org.apache.flinkx.api.serializers._ +import org.apache.flink.api.common.state.ValueStateDescriptor +import org.apache.flink.api.common.typeinfo.TypeInformation + +// state using flink-scala-api +val eventStateDescriptor = new ValueStateDescriptor[Option[String]]("event", + implicitly[TypeInformation[Option[String]]]) +``` + ## Usage `flink-scala-api` is released to Maven-central for 2.13 and 3. For SBT, add this snippet to `build.sbt`: