简体   繁体   中英

Kafka Messages are split in consumer

I am new to Kafka. I am sending a request to REST server and send the response of the request to kafka server as messages.

When i consume the data from consumer the message is split into multiple smaller messages. How do i avoid this. The response is a JSON row. I want each json row to be one message. Any help would be appreciated. The size of the Json is also not very big. A json with over 1500 rows is about 2 MB

For eg

ConsumerRecord(topic='meetup_sample', partition=0, offset=445386, >timestamp=1530554568191, timestamp_type=0, >key=b'5fa4964b035c072a81fedb93cfca8f0ecb562cf913c69f63efbbf4e799871f05', >value=b':"food-and-drink","topic_name":"Food and Drink"},{"urlkey":"newintown","topic_name":"New In Town"},{"urlkey":"beer","topic_name"', >checksum=None, serialized_key_size=64, serialized_value_size=128) ConsumerRecord(topic='meetup_sample', partition=0, offset=445387, >timestamp=1530554568192, timestamp_type=0, >key=b'1f170ceabf91335d332487ebb0890f0bd0ed69018c618ecc2c789a260d561f43', >value=b':"Beer"},{"urlkey":"game-night","topic_name":"Game Night"},{"urlkey":"happy-hours","topic_name":"Happy Hour"},{"urlkey":"water-s', >checksum=None, serialized_key_size=64, serialized_value_size=128)

Once use fetch.message.max.bytes=2000000 in consumer side

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM