Search code examples
springspring-bootapache-kafka

org.apache.kafka.common.errors.RecordTooLargeException: The request included a message larger than the max message size the server will accept


Im using kafka 2.11, getting the below exception

2019-03-15 16:41:19.469 ERROR 32539 --- [ad | producer-1] o.s.k.support.LoggingProducerListener : Exception thrown when sending a message with key='null' and payload='[{"id":1,"name":"Tow Motor","description":"Tow motor is moving from second row","xcoordinate":"2264"...' to topic Kafka_Json1:

org.apache.kafka.common.errors.RecordTooLargeException: The request included a message larger than the max message size the server will accept.


Solution

  • By default,Kafka accepts a message of size 1 MB. The size of your message is more than default size.

    You need to change the value of the property max.request.size,message.max.bytes and max.partition.fetch.bytes to fix this issue.