2017-08-22 33 views
1

我正在使用Spring Cloud Stream和Confluent Schema Registry来注册Avro模式。无法使用Confluent模式注册表和Spring云流反序列化Avro消息

模式已成功注册。但是,当我的流监听器收到消息时,有效负载仍然是字节。

这是我的属性。

spring.cloud.stream.schemaRegistryClient.endpoint=http://localhost:8081 
spring.cloud.stream.bindings.output.contentType=application/*+avro 
spring.cloud.stream.schema.avro.dynamic-schema-generation-enabled=true 
spring.cloud.stream.schemaRegistryClient.cached=true 
spring.cloud.stream.schema.avro.schemaLocations=classpath*:schemas/*.avsc 
spring.cloud.stream.bindings.input.contentType=application/*+avro 

当接收消息我注意到, “convertFromInternal” 中的 “AbstractAvroMessageConverter” 永远不会被调用这是假设解码消息。

回答

0

您使用的是什么版本的SCSt?在1.3上与confluent模式注册表服务器集成时,我们解决了几个问题。

此外,您不需要设置输入contentType,通过包含application/vnd*+avro的标头进行解析,这是转换器启动并从服务器中找到正确架构的提示。您只在输出通道上设置contentType,将其替换为正确的版本,例如:application/vnd.user.v1+avro

+0

我正在使用SCSt 1.2.2.RELEASE。我需要升级吗? – RSM

+0

从注册表获取模式时存在问题,仅在1.3分支上修复。另一件事是你的制片人是怎样的?尝试删除输入contentType定义,你应该只依靠标题 –

+0

我试着删除contentType的输入,但仍然有相同的问题。我有一些头\t messageChannel.send(MessageBuilder.withPayload(请求) \t \t \t \t .setHeader( “RetryCount重”, “0”) \t \t \t \t .setHeader( “createUserId”,RequestContext.getCurrentContext简单生产().getUserId())) \t \t \t \t .build());预定发布1.3版本吗? – RSM