[英]How to set AvroCoder with KafkaIO and Apache Beam with Java
[英]how to specify kafka brokers with KafkaIO in Apache Beam
我正在嘗試設置 KafkaIO 管道,但我不知道如何指定代理。 指定經紀人名稱和端口似乎並沒有這樣做。 我從來沒有指定我的 kafka 集群在哪里:
pipeline
.apply(KafkaIO.<Long, String>read()
.withBootstrapServers("broker.id__1:9092")
.withTopic("pageviews")
這給了我錯誤:
Exception in thread "main" org.apache.beam.sdk.Pipeline$PipelineExecutionException: org.apache.kafka.common.KafkaException: Failed to construct kafka consumer
at org.apache.beam.sdk.Pipeline.run(Pipeline.java:323)
...
Caused by: org.apache.kafka.common.config.ConfigException: No resolvable bootstrap urls given in bootstrap.servers
我的 Kafka 集群在本地運行,並且代理 ID 正確。
我錯過了什么? 指定經紀人的正確方法是什么?
原來這很簡單
withBootstrapServers("localhost:9092")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.