spring cloud 多重绑定在 3.2.2 jar 中不起作用
我正在尝试使用 Avro 输入消息将 json(topic-json) 和 avro(topic-avro) 消息发送到多个主题。当我将“binder”设置为值(即binder:kafka-1-with-ssl)时,出现 application.yaml 错误。我还使用下面的 jars:
"org.springframework.cloud:spring-cloud-stream-binder-kafka-streams",-->3.2.2
"org.springframework.cloud:spring-cloud-stream-binder-kafka",-->3.2.2
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2021.0.1"
}
}
我不确定我在下面的 yaml 文件中做错了什么。
spring:
cloud:
stream:
function:
definition: processor
bindings:
processor-in-0:
content-type: application/json
destination: input-topic-in-avro
consumer:
use-native-decoding: true
processor-out-0:
binder: kafka-1-with-ssl
destination: topic-json
content-type: application/json
producer:
use-native-encoding: true
key-serializer: org.apache.kafka.common.serialization.Serdes$StringSerde
value-serializer: org.springframework.kafka.support.serializer.JsonSerde
error-out-0:
binder: kafka-2-with-ssl
destination: topic-avro
content-type: application/json
producer:
use-native-encoding: true
key-serializer: org.apache.kafka.common.serialization.StringSerializer
value-serializer: io.confluent.kafka.serializers.KafkaAvroSerializer
binders:
kafka-1-with-ssl:
type: kafka
environment:
spring.cloud.stream.kafka.binder:
auto-create-topics: false
brokers: <broker-name>
configuration: # Common properties for SSL...
producer-properties:
key.serializer: org.apache.kafka.common.serialization.StringSerializer
value.serializer: org.springframework.kafka.support.serializer.JsonSerializer
kafka-2-with-ssl:
type: kafka
environment:
spring:
cloud:
stream:
kafka:
binder:
auto-create-topics: false
brokers: <broker-name>
configuration: # Common properties for SSL...
producer-properties:
key.serializer: org.apache.kafka.common.serialization.StringSerializer
value.serializer: io.confluent.kafka.serializers.KafkaAvroSerializer
schema.registry.url: <registry-url>
先感谢您。
I am trying to send json(topic-json) and avro(topic-avro) messages to multiple topics with Avro input message. I am getting application.yaml error when I set "binder" with value i.e. binder: kafka-1-with-ssl. I am also using below jars:
"org.springframework.cloud:spring-cloud-stream-binder-kafka-streams",-->3.2.2
"org.springframework.cloud:spring-cloud-stream-binder-kafka",-->3.2.2
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2021.0.1"
}
}
I am not sure what I am doing wrong in below yaml file.
spring:
cloud:
stream:
function:
definition: processor
bindings:
processor-in-0:
content-type: application/json
destination: input-topic-in-avro
consumer:
use-native-decoding: true
processor-out-0:
binder: kafka-1-with-ssl
destination: topic-json
content-type: application/json
producer:
use-native-encoding: true
key-serializer: org.apache.kafka.common.serialization.Serdes$StringSerde
value-serializer: org.springframework.kafka.support.serializer.JsonSerde
error-out-0:
binder: kafka-2-with-ssl
destination: topic-avro
content-type: application/json
producer:
use-native-encoding: true
key-serializer: org.apache.kafka.common.serialization.StringSerializer
value-serializer: io.confluent.kafka.serializers.KafkaAvroSerializer
binders:
kafka-1-with-ssl:
type: kafka
environment:
spring.cloud.stream.kafka.binder:
auto-create-topics: false
brokers: <broker-name>
configuration: # Common properties for SSL...
producer-properties:
key.serializer: org.apache.kafka.common.serialization.StringSerializer
value.serializer: org.springframework.kafka.support.serializer.JsonSerializer
kafka-2-with-ssl:
type: kafka
environment:
spring:
cloud:
stream:
kafka:
binder:
auto-create-topics: false
brokers: <broker-name>
configuration: # Common properties for SSL...
producer-properties:
key.serializer: org.apache.kafka.common.serialization.StringSerializer
value.serializer: io.confluent.kafka.serializers.KafkaAvroSerializer
schema.registry.url: <registry-url>
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论