关于如何让一个简单的 .net Kafka 客户端连接到代理的任何提示?
我构建了 Apache Kafka 并成功遵循了快速入门(主题创建、事件产生、事件消费)。
使用 Confluent.Kafka v2.1.1 我尝试阅读主题元数据:
var adminConfig = new AdminClientConfig()
{
BootstrapServers = "localhost:9092"
};
adminConfig.Debug = "all";
using (var adminClient = new AdminClientBuilder(adminConfig).Build())
{
var metadata = adminClient.GetMetadata(TimeSpan.FromSeconds(10));
var topicsMetadata = metadata.Topics;
var topicNames = metadata.Topics.Select(a => a.Topic).ToList();
Console.WriteLine($"Topics: {string.Join(',',topicNames)}");
}
var metadata = ...
行抛出 Confluent.Kafka.KafkaException 'Local: Broker transport failure'
终端登录显示以下内容不断循环:
- xxx: Received CONNECT op
- xxx: Broker changed state INIT -> TRY_CONNECT
- xxx: Broadcasting state change
- xxx: broker in state TRY_CONNECT connecting
- xxx: Broker changed state TRY_CONNECT -> CONNECT
- xxx: Broadcasting state change
- xxx: Connecting to ipv6#[::1]:9092 (plaintext) with socket 1308
- xxx: Connected to ipv6#[::1]:9092
- xxx: localhost:9092/bootstrap: Connected (#12)
- xxx: localhost:9092/bootstrap: Updated enabled protocol features +ApiVersion to ApiVersion
- xxx: Broker changed state CONNECT -> APIVERSION_QUERY
- xxx: Broadcasting state change
- xxx: localhost:9092/bootstrap: Sent ApiVersionRequest (v3, 52 bytes @ 0, CorrId 12)
- xxx: Cluster connection already in progress: no cluster connection
- xxx: Cluster connection already in progress: no cluster connection
- xxx: Cluster connection already in progress: no cluster connection
- xxx: Cluster connection already in progress: no cluster connection
- xxx: Cluster connection already in progress: no cluster connection
- xxx: Cluster connection already in progress: no cluster connection
- xxx: Timed out ApiVersionRequest in flight (after 10115ms, timeout #0)
- xxx: ApiVersionRequest failed: Local: Timed out: probably due to broker version < 0.10 (see api.version.request configuration) (after 10116ms in state APIVERSION_QUERY) (_TRANSPORT): identical to last error: error log suppressed
- xxx: Updated enabled protocol features -ApiVersion to
- xxx: localhost:9092/bootstrap: Broker changed state APIVERSION_QUERY -> DOWN
- xxx: Broadcasting state change
- xxx: Purging bufq with 0 buffers
- xxx: Purging bufq with 0 buffers
- xxx: Updating 0 buffers on connection reset
- xxx: Timed out 1 in-flight, 0 retry-queued, 0 out-queue, 0 partially-sent requests
- xxx: Broker changed state DOWN -> INIT
- xxx: Broadcasting state change
- xxx: Selected for cluster connection: no cluster connection (broker has 11 connection attempt(s))