2017-08-22 30 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

相關問題