简体   繁体   English

Avro 架构对象通用 kafkaTemplate 类型 - 生成消息

[英]Avro schema object generic kafkaTemplate type - produce message

I have situation where my kafka template looks like this:我的 kafka 模板如下所示:

KafkaTemplate<String, InternalSelfServiceData> kafkaTemplate;

Where: InternalSelfServiceData -> Avro schema object其中: InternalSelfServiceData -> Avro 架构对象

When i call kafkaTemplate.send() my return type is ListenableFuture<SendResult<String, InternalSelfServiceData>> .当我调用kafkaTemplate.send()我的返回类型是ListenableFuture<SendResult<String, InternalSelfServiceData>> Next i pass this data as a parametr to the next method but i want this method to be generic one so i wanted from them to accept parameter like this ListenableFuture<SendResult<String, ? extends SpecificRecordBase>>接下来,我将此数据作为参数传递给下一个方法,但我希望此方法是通用方法,因此我希望他们接受这样的参数ListenableFuture<SendResult<String, ? extends SpecificRecordBase>> ListenableFuture<SendResult<String, ? extends SpecificRecordBase>> . ListenableFuture<SendResult<String, ? extends SpecificRecordBase>>

The error that occurs in IntelliJ is: IntelliJ中发生的错误是:

Required type: ListenableFuture <SendResult<String, ?所需类型:ListenableFuture <SendResult<String, ? extends SpecificRecordBase>>扩展特定记录库>>

Provided: ListenableFuture <SendResult<String, InternalSelfServiceData>提供:ListenableFuture <SendResult<String, InternalSelfServiceData>

Any suggestion what I missing?任何建议我错过了什么?

尝试将您的数据编码为字节数组(org.apache.avro.specific.SpecificDatumWriter)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM