Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

On kafka console not able to type message with size more than 4095 characters

I am trying to send message through kafka console producer. But I am not able to type messages more than 4095 characters. Tried to search if there is any property related to this in producer or server but to not avail. Even tried to search if there is any OS specific limitation or stdin character limitation but did not find anything.

Please help in sending large message through console producer.

like image 658
user2714361 Avatar asked Jun 08 '16 14:06

user2714361


People also ask

What is the maximum size of Kafka message?

The Kafka max message size is 1MB. In this lesson we will look at two approaches for handling larger messages in Kafka. Kafka has a default limit of 1MB per message in the topic.

How do you handle a large message in Kafka?

Kafka Broker Configuration An optional configuration property, “message. max. bytes“, can be used to allow all topics on a Broker to accept messages of greater than 1MB in size. And this holds the value of the largest record batch size allowed by Kafka after compression (if compression is enabled).

What is the default maximum message size a Kafka broker can receive?

Out of the box, the Kafka brokers can handle messages up to 1MB (in practice, a little bit less than 1MB) with the default configuration settings, though Kafka is optimized for small messages of about 1K in size.


1 Answers

I found an alternate to do this. Add a file with your input and then send it to the producer. Use the following command:

cat yourFile.xml | kafka-console-producer --broker-list localhost:9092 --topic TopicName

It helps if the contents of your file are in single line. Hopefully, this helps.

like image 145
Sanjeeta Avatar answered Oct 13 '22 23:10

Sanjeeta