In this example, my client is running on my laptop, connecting to Kafka running on another machine on my LAN called
The initial connection succeeds. But note that the
BrokerMetadatawe get back shows that there is one broker, with a hostname of
localhost. That means that our client is going to be using
localhostto try to connect to a broker when producing and consuming messages. That’s bad news, because on our client machine, there is no Kafka broker at
localhost(or if there happened to be, some really weird things would probably happen).
As usual, things boil down to “Configure it correctly and it works.”