我正在尝试使用Spring Cloud和Kafka Avro序列化器在Kafka上生成一个事件。
在application.yml中,我有下面的配置,但是当序列化程序尝试生成消息时,它会生成字节,因为传递给KafkaSerializer中getScheme方法的对象是字节数组,而不是GenericRecord。我认为我需要在Spring Cloud中使用一个特定的消息转换器,但是我没有找到。
cloud:
stream:
kafka:
binder:
brokers:
- 'localhost:9092'
useNativeDecoding: true
bindings:
Ptr-output:
producer:
configuration:
schema.registry.url: 'http://localhost:8081'
key.serializer: org.apache.kafka.common.serialization.StringSerializer
value.serializer: com.abc.message.ptr.KafkaSerializer
schemaRegistryClient:
endpoint: 'http://localhost:8081'
bindings:
Ptr-output:
contentType: application/*+avro
destination: Ptr
schema:
avro:
schema-locations: 'classpath:avro/Ptr.avsc'
dynamic-schema-generation-enabled: false
我该怎么办?我该怎么解决?