{"id":39,"date":"2021-11-08T18:40:13","date_gmt":"2021-11-08T18:40:13","guid":{"rendered":"https:\/\/blog.kevinyohe.dev\/?p=39"},"modified":"2021-11-08T18:40:13","modified_gmt":"2021-11-08T18:40:13","slug":"kafka-record-producerrecord","status":"publish","type":"post","link":"https:\/\/blog.kevinyohe.dev\/?p=39","title":{"rendered":"Kafka Record\/ProducerRecord"},"content":{"rendered":"\n<p><a href=\"https:\/\/kafka.apache.org\/23\/javadoc\/org\/apache\/kafka\/clients\/producer\/ProducerRecord.html\">https:\/\/kafka.apache.org\/23\/javadoc\/org\/apache\/kafka\/clients\/producer\/ProducerRecord.html<\/a><\/p>\n\n\n\n<p>Sends data to Kafka for holding\/sending to consumers.<\/p>\n\n\n\n<p>public class <strong>ProducerRecord&lt;K,V><\/strong> extends <a href=\"https:\/\/docs.oracle.com\/javase\/8\/docs\/api\/java\/lang\/Object.html?is-external=true\">Object<\/a><\/p>\n\n\n\n<p>A key\/value pair to be sent to Kafka. This consists of a topic name to which the record is being sent, an optional partition number, and an optional key and value. If a valid partition number is specified that partition will be used when sending the record. If no partition is specified but a key is present a partition will be chosen using a hash of the key. If neither key nor partition is present a partition will be assigned in a round-robin fashion. The record also has an associated timestamp. If the user did not provide a timestamp, the producer will stamp the record with its current time. The timestamp eventually used by Kafka depends on the timestamp type configured for the topic.<\/p>\n\n\n\n<p>If the topic is configured to use\u00a0<code>CreateTime<\/code>, the timestamp in the producer record will be used by the broker.<\/p>\n\n\n\n<p>If the topic is configured to use\u00a0<code>LogAppendTime<\/code>, the timestamp in the producer record will be overwritten by the broker with the broker local time when it appends the message to its log.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/kafka.apache.org\/23\/javadoc\/org\/apache\/kafka\/clients\/producer\/ProducerRecord.html Sends data to Kafka for holding\/sending to consumers. public class ProducerRecord&lt;K,V> extends Object A key\/value pair to be sent to Kafka. This consists of a topic name to which the record is being sent, an optional partition number, and an optional key and value. If a valid partition number is specified that partition will&hellip; <a class=\"more-link\" href=\"https:\/\/blog.kevinyohe.dev\/?p=39\">Continue reading <span class=\"screen-reader-text\">Kafka Record\/ProducerRecord<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-39","post","type-post","status-publish","format-standard","hentry","category-uncategorized","entry"],"_links":{"self":[{"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=\/wp\/v2\/posts\/39","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=39"}],"version-history":[{"count":1,"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=\/wp\/v2\/posts\/39\/revisions"}],"predecessor-version":[{"id":40,"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=\/wp\/v2\/posts\/39\/revisions\/40"}],"wp:attachment":[{"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=39"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=39"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=39"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}