我目前正在评估在新项目中使用春季云流运动学绑定器的可能性,但是我遇到了一些问题。
当我启用了kcl-kpl时:false一切正常。但是,当我启用了kcl-kop时,会不断出现以下错误:
org.springframework.core.serializer.support.SerializationFailedException: Failed to deserialize payload. Is the byte array a result of corresponding serialization for DefaultDeserializer?; nested exception is java.io.StreamCorruptedException: invalid stream header: 61686868
这是我当前的配置:
spring:
cloud:
stream:
kinesis:
binder:
checkpoint:
create-delay: 0
table: feeder_mycollection_changes_table
kpl-kcl-enabled: true
bindings:
processEvent-in-0:
consumer:
shardIteratorType: TRIM_HORIZON
bindings:
processEvent-in-0:
destination: mycollection_changes_stream
content-type: application/json
consumer:
headerMode: none
我在测试中使用的依赖项的版本是:
<spring-cloud.version>Hoxton.RC2</spring-cloud.version>
<spring-cloud-stream.version>Horsham.RC2</spring-cloud-stream.version>
<spring-cloud-stream-kinesis.version>2.0.0.BUILD-SNAPSHOT</spring-cloud-stream-kinesis.version>
问题是converter
中的默认KclMessageDrivenChannelAdapter
是DeserializingConverter
。
Spring Cloud Stream不处理Java序列化,它具有自己的转换byte[]
的机制。因此,我们需要修复一个Binder实现,以依赖于Spring Cloud Stream转换基础结构。