Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-25197

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

    XMLWordPrintableJSON

Details

    Description

      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, a default instance of ObjectMapper is used to serialize the client properties, which now include a java.time.Duration. There is a StateFunObjectMapper 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 StateFunObjectMapper 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.

       

      Attachments

        Issue Links

          Activity

            People

              galenwarren Galen Warren
              galenwarren Galen Warren
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: