Trying to send message from my local to remote Kafka
server.properties file:-
listeners=PLAINTEXT://0.0.0.0:9092
advertised.listeners=PLAINTEXT://<PUBLIC_IP>:9092
Tried to produce using the command
./bin/kafka-console-producer.sh --broker-list <PUBLIC_IP>:9092 --topic first_topic
Tried to consume using the command
./bin/kafka-console-consumer.sh --bootstrap-server <PUBLIC_IP>:9092 --topic first_topic --from-beginning
Getting the following error while producing
org.apache.kafka.common.KafkaException: Producer closed while send in progress
at org.apache.kafka.clients.producer.KafkaProducer.doSend(KafkaProducer.java:894)
at org.apache.kafka.clients.producer.KafkaProducer.send(KafkaProducer.java:870)
at kafka.tools.ConsoleProducer$.send(ConsoleProducer.scala:71)
at kafka.tools.ConsoleProducer$.main(ConsoleProducer.scala:53)
at kafka.tools.ConsoleProducer.main(ConsoleProducer.scala)
Caused by: org.apache.kafka.common.KafkaException: Requested metadata update after close
at org.apache.kafka.clients.producer.internals.ProducerMetadata.awaitUpdate(ProducerMetadata.java:126)
at org.apache.kafka.clients.producer.KafkaProducer.waitOnMetadata(KafkaProducer.java:1032)
at org.apache.kafka.clients.producer.KafkaProducer.doSend(KafkaProducer.java:891)
... 4 more
What else should be configured to produce to Kafka hosted in remote server. I have also opened the port 9092 and there is no authorization/authentication enabled.
The problem seems to be with Azure. Solved by changing the server.properties file with the following configuration:-
listener.security.protocol.map=INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
advertised.listeners=INTERNAL://:19092,EXTERNAL://<public_ip>:9092
listeners=INTERNAL://:19092,EXTERNAL://<public_ip>:9092