Galen Warren created FLINK-25197: ------------------------------------ Summary: Using Statefun RequestReplyFunctionBuilder fails with Java 8 date/time type `java.time.Duration` not supported by default: add Module "org.apache.flink.shaded.jackson2.com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling Key: FLINK-25197 URL: https://issues.apache.org/jira/browse/FLINK-25197 Project: Flink Issue Type: Bug Components: Stateful Functions Affects Versions: statefun-3.1.0 Reporter: Galen Warren Fix For: statefun-3.1.0
When using RequestReplyFunctionBuilder to build a stateful functions job, the job fails at runtime with: Java 8 date/time type `java.time.Duration` not supported by default: add Module "org.apache.flink.shaded.jackson2.com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling It appears this is because, in [RequestReplyFunctionBuilder::transportClientPropertiesAsObjectNode|https://github.com/apache/flink-statefun/blob/b4ba9547b8f0105a28544fd28a5e0433666e9023/statefun-flink/statefun-flink-datastream/src/main/java/org/apache/flink/statefun/flink/datastream/RequestReplyFunctionBuilder.java#L127], a default instance of ObjectMapper is used to serialize the client properties, which now include a java.time.Duration. There is a [StateFunObjectMapper|https://github.com/apache/flink-statefun/blob/master/statefun-flink/statefun-flink-common/src/main/java/org/apache/flink/statefun/flink/common/json/StateFunObjectMapper.java] class in the project that has customized serde support, but it is not used here. The fix seems to be to: * Use an instance of StateFunObjectMapper to serialize the client properties in RequestReplyFunctionBuilder * Modify StateFunObjecdtMapper to both serialize and deserialize instances of java.time.Duration (currently, only deserialization is supported) I've made these changes locally and it seems to fix the problem. Would you be interested in a PR? Thanks. -- This message was sent by Atlassian Jira (v8.20.1#820001)