blob: a2140eb973ba9274b5a851c47b722d8d8bdea62f [file] [log] [blame]
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"></meta><title>ConsumeKafkaRecord_2_6</title><link rel="stylesheet" href="../../../../../css/component-usage.css" type="text/css"></link></head><script type="text/javascript">window.onload = function(){if(self==top) { document.getElementById('nameHeader').style.display = "inherit"; } }</script><body><h1 id="nameHeader" style="display: none;">ConsumeKafkaRecord_2_6</h1><h2>Description: </h2><p>Consumes messages from Apache Kafka specifically built against the Kafka 2.6 Consumer API. The complementary NiFi processor for sending messages is PublishKafkaRecord_2_6. Please note that, at this time, the Processor assumes that all records that are retrieved from a given partition have the same schema. If any of the Kafka messages are pulled but cannot be parsed or written with the configured Record Reader or Record Writer, the contents of the message will be written to a separate FlowFile, and that FlowFile will be transferred to the 'parse.failure' relationship. Otherwise, each FlowFile is sent to the 'success' relationship and may contain many individual messages within the single FlowFile. A 'record.count' attribute is added to indicate how many messages are contained in the FlowFile. No two Kafka messages will be placed into the same FlowFile if they have different schemas, or if they have different values for a message header that is included by the &lt;Headers to Add as Attributes&gt; property.</p><p><a href="additionalDetails.html">Additional Details...</a></p><h3>Tags: </h3><p>Kafka, Get, Record, csv, avro, json, Ingest, Ingress, Topic, PubSub, Consume, 2.6</p><h3>Properties: </h3><p>In the list below, the names of required properties appear in <strong>bold</strong>. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the <a href="../../../../../html/expression-language-guide.html">NiFi Expression Language</a>.</p><table id="properties"><tr><th>Display Name</th><th>API Name</th><th>Default Value</th><th>Allowable Values</th><th>Description</th></tr><tr><td id="name"><strong>Kafka Brokers</strong></td><td>bootstrap.servers</td><td id="default-value">localhost:9092</td><td id="allowable-values"></td><td id="description">Comma-separated list of Kafka Brokers in the format host:port<br/><strong>Supports Expression Language: true (will be evaluated using variable registry only)</strong></td></tr><tr><td id="name"><strong>Topic Name(s)</strong></td><td>topic</td><td></td><td id="allowable-values"></td><td id="description">The name of the Kafka Topic(s) to pull from. More than one can be supplied if comma separated.<br/><strong>Supports Expression Language: true (will be evaluated using variable registry only)</strong></td></tr><tr><td id="name"><strong>Topic Name Format</strong></td><td>topic_type</td><td id="default-value">names</td><td id="allowable-values"><ul><li>names <img src="../../../../../html/images/iconInfo.png" alt="Topic is a full topic name or comma separated list of names" title="Topic is a full topic name or comma separated list of names"></img></li><li>pattern <img src="../../../../../html/images/iconInfo.png" alt="Topic is a regex using the Java Pattern syntax" title="Topic is a regex using the Java Pattern syntax"></img></li></ul></td><td id="description">Specifies whether the Topic(s) provided are a comma separated list of names or a single regular expression</td></tr><tr><td id="name"><strong>Value Record Reader</strong></td><td>record-reader</td><td></td><td id="allowable-values"><strong>Controller Service API: </strong><br/>RecordReaderFactory<br/><strong>Implementations: </strong><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.grok.GrokReader/index.html">GrokReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.xml.XMLReader/index.html">XMLReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.avro.AvroReader/index.html">AvroReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.syslog.Syslog5424Reader/index.html">Syslog5424Reader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.cef.CEFReader/index.html">CEFReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.syslog.SyslogReader/index.html">SyslogReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.json.JsonTreeReader/index.html">JsonTreeReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.csv.CSVReader/index.html">CSVReader</a><br/><a href="../../../nifi-scripting-nar/1.19.1/org.apache.nifi.record.script.ScriptedReader/index.html">ScriptedReader</a><br/><a href="../../../nifi-parquet-nar/1.19.1/org.apache.nifi.parquet.ParquetReader/index.html">ParquetReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.json.JsonPathReader/index.html">JsonPathReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.lookup.ReaderLookup/index.html">ReaderLookup</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.windowsevent.WindowsEventLogReader/index.html">WindowsEventLogReader</a></td><td id="description">The Record Reader to use for incoming FlowFiles</td></tr><tr><td id="name"><strong>Record Value Writer</strong></td><td>record-writer</td><td></td><td id="allowable-values"><strong>Controller Service API: </strong><br/>RecordSetWriterFactory<br/><strong>Implementations: </strong><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.text.FreeFormTextRecordSetWriter/index.html">FreeFormTextRecordSetWriter</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.avro.AvroRecordSetWriter/index.html">AvroRecordSetWriter</a><br/><a href="../../../nifi-scripting-nar/1.19.1/org.apache.nifi.record.script.ScriptedRecordSetWriter/index.html">ScriptedRecordSetWriter</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.csv.CSVRecordSetWriter/index.html">CSVRecordSetWriter</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.xml.XMLRecordSetWriter/index.html">XMLRecordSetWriter</a><br/><a href="../../../nifi-parquet-nar/1.19.1/org.apache.nifi.parquet.ParquetRecordSetWriter/index.html">ParquetRecordSetWriter</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.json.JsonRecordSetWriter/index.html">JsonRecordSetWriter</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.lookup.RecordSetWriterLookup/index.html">RecordSetWriterLookup</a></td><td id="description">The Record Writer to use in order to serialize the data before sending to Kafka</td></tr><tr><td id="name"><strong>Group ID</strong></td><td>group.id</td><td></td><td id="allowable-values"></td><td id="description">A Group ID is used to identify consumers that are within the same consumer group. Corresponds to Kafka's 'group.id' property.<br/><strong>Supports Expression Language: true (will be evaluated using variable registry only)</strong></td></tr><tr><td id="name"><strong>Output Strategy</strong></td><td>output-strategy</td><td id="default-value">Use Content as Value</td><td id="allowable-values"><ul><li>Use Content as Value <img src="../../../../../html/images/iconInfo.png" alt="Write only the Kafka Record value to the FlowFile record." title="Write only the Kafka Record value to the FlowFile record."></img></li><li>Use Wrapper <img src="../../../../../html/images/iconInfo.png" alt="Write the Kafka Record key, value, headers, and metadata into the FlowFile record. (See processor usage for more information.)" title="Write the Kafka Record key, value, headers, and metadata into the FlowFile record. (See processor usage for more information.)"></img></li></ul></td><td id="description">The format used to output the Kafka record into a FlowFile record.</td></tr><tr><td id="name">Headers to Add as Attributes (Regex)</td><td>header-name-regex</td><td></td><td id="allowable-values"></td><td id="description">A Regular Expression that is matched against all message headers. Any message header whose name matches the regex will be added to the FlowFile as an Attribute. If not specified, no Header values will be added as FlowFile attributes. If two messages have a different value for the same header and that header is selected by the provided regex, then those two messages must be added to different FlowFiles. As a result, users should be cautious about using a regex like ".*" if messages are expected to have header values that are unique per message, such as an identifier or timestamp, because it will prevent NiFi from bundling the messages together efficiently.<br/><br/><strong>This Property is only considered if </strong><strong>the [Output Strategy] Property has a value of "Use Content as Value".</strong></td></tr><tr><td id="name"><strong>Key Attribute Encoding</strong></td><td>key-attribute-encoding</td><td id="default-value">UTF-8 Encoded</td><td id="allowable-values"><ul><li>UTF-8 Encoded <img src="../../../../../html/images/iconInfo.png" alt="The key is interpreted as a UTF-8 Encoded string." title="The key is interpreted as a UTF-8 Encoded string."></img></li><li>Hex Encoded <img src="../../../../../html/images/iconInfo.png" alt="The key is interpreted as arbitrary binary data and is encoded using hexadecimal characters with uppercase letters" title="The key is interpreted as arbitrary binary data and is encoded using hexadecimal characters with uppercase letters"></img></li><li>Do Not Add Key as Attribute <img src="../../../../../html/images/iconInfo.png" alt="The key will not be added as an Attribute" title="The key will not be added as an Attribute"></img></li></ul></td><td id="description">If the &lt;Separate By Key&gt; property is set to true, FlowFiles that are emitted have an attribute named 'kafka.key'. This property dictates how the value of the attribute should be encoded.<br/><br/><strong>This Property is only considered if </strong><strong>the [Output Strategy] Property has a value of "Use Content as Value".</strong></td></tr><tr><td id="name"><strong>Key Format</strong></td><td>key-format</td><td id="default-value">Byte Array</td><td id="allowable-values"><ul><li>String <img src="../../../../../html/images/iconInfo.png" alt="Format the Kafka ConsumerRecord key as a UTF-8 string." title="Format the Kafka ConsumerRecord key as a UTF-8 string."></img></li><li>Byte Array <img src="../../../../../html/images/iconInfo.png" alt="Format the Kafka ConsumerRecord key as a byte array." title="Format the Kafka ConsumerRecord key as a byte array."></img></li><li>Record <img src="../../../../../html/images/iconInfo.png" alt="Format the Kafka ConsumerRecord key as a record." title="Format the Kafka ConsumerRecord key as a record."></img></li></ul></td><td id="description">Specifies how to represent the Kafka Record's Key in the output<br/><br/><strong>This Property is only considered if </strong><strong>the [Output Strategy] Property has a value of "Use Wrapper".</strong></td></tr><tr><td id="name">Key Record Reader</td><td>key-record-reader</td><td></td><td id="allowable-values"><strong>Controller Service API: </strong><br/>RecordReaderFactory<br/><strong>Implementations: </strong><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.grok.GrokReader/index.html">GrokReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.xml.XMLReader/index.html">XMLReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.avro.AvroReader/index.html">AvroReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.syslog.Syslog5424Reader/index.html">Syslog5424Reader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.cef.CEFReader/index.html">CEFReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.syslog.SyslogReader/index.html">SyslogReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.json.JsonTreeReader/index.html">JsonTreeReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.csv.CSVReader/index.html">CSVReader</a><br/><a href="../../../nifi-scripting-nar/1.19.1/org.apache.nifi.record.script.ScriptedReader/index.html">ScriptedReader</a><br/><a href="../../../nifi-parquet-nar/1.19.1/org.apache.nifi.parquet.ParquetReader/index.html">ParquetReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.json.JsonPathReader/index.html">JsonPathReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.lookup.ReaderLookup/index.html">ReaderLookup</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.windowsevent.WindowsEventLogReader/index.html">WindowsEventLogReader</a></td><td id="description">The Record Reader to use for parsing the Kafka Record's key into a Record<br/><br/><strong>This Property is only considered if </strong><strong>the [Key Format] Property has a value of "Record".</strong></td></tr><tr><td id="name">Commit Offsets</td><td>Commit Offsets</td><td id="default-value">true</td><td id="allowable-values"><ul><li>true</li><li>false</li></ul></td><td id="description">Specifies whether or not this Processor should commit the offsets to Kafka after receiving messages. This value should be false when a PublishKafkaRecord processor is expected to commit the offsets using Exactly Once semantics, and should be reserved for dataflows that are designed to run within Stateless NiFi. See Processor's Usage / Additional Details for more information. Note that setting this value to false can lead to significant data duplication or potentially even data loss if the dataflow is not properly configured.</td></tr><tr><td id="name">Max Uncommitted Time</td><td>max-uncommit-offset-wait</td><td id="default-value">1 secs</td><td id="allowable-values"></td><td id="description">Specifies the maximum amount of time allowed to pass before offsets must be committed. This value impacts how often offsets will be committed. Committing offsets less often increases throughput but also increases the window of potential data duplication in the event of a rebalance or JVM restart between commits. This value is also related to maximum poll records and the use of a message demarcator. When using a message demarcator we can have far more uncommitted messages than when we're not as there is much less for us to keep track of in memory.<br/><br/><strong>This Property is only considered if </strong><strong>the [Commit Offsets] Property has a value of "true".</strong></td></tr><tr><td id="name"><strong>Honor Transactions</strong></td><td>honor-transactions</td><td id="default-value">true</td><td id="allowable-values"><ul><li>true</li><li>false</li></ul></td><td id="description">Specifies whether or not NiFi should honor transactional guarantees when communicating with Kafka. If false, the Processor will use an "isolation level" of read_uncomitted. This means that messages will be received as soon as they are written to Kafka but will be pulled, even if the producer cancels the transactions. If this value is true, NiFi will not receive any messages for which the producer's transaction was canceled, but this can result in some latency since the consumer must wait for the producer to finish its entire transaction instead of pulling as the messages become available.</td></tr><tr><td id="name"><strong>Security Protocol</strong></td><td>security.protocol</td><td id="default-value">PLAINTEXT</td><td id="allowable-values"><ul><li>PLAINTEXT</li><li>SSL</li><li>SASL_PLAINTEXT</li><li>SASL_SSL</li></ul></td><td id="description">Security protocol used to communicate with brokers. Corresponds to Kafka Client security.protocol property</td></tr><tr><td id="name"><strong>SASL Mechanism</strong></td><td>sasl.mechanism</td><td id="default-value">GSSAPI</td><td id="allowable-values"><ul><li>GSSAPI <img src="../../../../../html/images/iconInfo.png" alt="General Security Services API for Kerberos authentication" title="General Security Services API for Kerberos authentication"></img></li><li>PLAIN <img src="../../../../../html/images/iconInfo.png" alt="Plain username and password authentication" title="Plain username and password authentication"></img></li><li>SCRAM-SHA-256 <img src="../../../../../html/images/iconInfo.png" alt="Salted Challenge Response Authentication Mechanism using SHA-512 with username and password" title="Salted Challenge Response Authentication Mechanism using SHA-512 with username and password"></img></li><li>SCRAM-SHA-512 <img src="../../../../../html/images/iconInfo.png" alt="Salted Challenge Response Authentication Mechanism using SHA-256 with username and password" title="Salted Challenge Response Authentication Mechanism using SHA-256 with username and password"></img></li></ul></td><td id="description">SASL mechanism used for authentication. Corresponds to Kafka Client sasl.mechanism property</td></tr><tr><td id="name">Kerberos Credentials Service</td><td>kerberos-credentials-service</td><td></td><td id="allowable-values"><strong>Controller Service API: </strong><br/>KerberosCredentialsService<br/><strong>Implementation: </strong><a href="../../../nifi-kerberos-credentials-service-nar/1.19.1/org.apache.nifi.kerberos.KeytabCredentialsService/index.html">KeytabCredentialsService</a></td><td id="description">Service supporting generalized credentials authentication with Kerberos</td></tr><tr><td id="name">Kerberos Service Name</td><td>sasl.kerberos.service.name</td><td></td><td id="allowable-values"></td><td id="description">The service name that matches the primary name of the Kafka server configured in the broker JAAS configuration<br/><strong>Supports Expression Language: true (will be evaluated using variable registry only)</strong></td></tr><tr><td id="name">Kerberos Principal</td><td>sasl.kerberos.principal</td><td></td><td id="allowable-values"></td><td id="description">Principal used for authentication with Kerberos<br/><strong>Supports Expression Language: true (will be evaluated using variable registry only)</strong></td></tr><tr><td id="name">Kerberos Keytab</td><td>sasl.kerberos.keytab</td><td></td><td id="allowable-values"></td><td id="description">Keytab credentials used for authentication with Kerberos<br/><br/><strong>This property requires exactly one file to be provided..</strong><br/><br/><strong>Supports Expression Language: true (will be evaluated using variable registry only)</strong></td></tr><tr><td id="name">Username</td><td>sasl.username</td><td></td><td id="allowable-values"></td><td id="description">Username provided with configured password when using PLAIN or SCRAM SASL Mechanisms<br/><strong>Supports Expression Language: true (will be evaluated using variable registry only)</strong><br/><br/><strong>This Property is only considered if </strong><strong>the [SASL Mechanism] Property is set to one of the following values: [PLAIN], [SCRAM-SHA-512], [SCRAM-SHA-256]</strong></td></tr><tr><td id="name">Password</td><td>sasl.password</td><td></td><td id="allowable-values"></td><td id="description">Password provided with configured username when using PLAIN or SCRAM SASL Mechanisms<br/><strong>Sensitive Property: true</strong><br/><strong>Supports Expression Language: true (will be evaluated using variable registry only)</strong><br/><br/><strong>This Property is only considered if </strong><strong>the [SASL Mechanism] Property is set to one of the following values: [PLAIN], [SCRAM-SHA-512], [SCRAM-SHA-256]</strong></td></tr><tr><td id="name">Token Authentication</td><td>sasl.token.auth</td><td id="default-value">false</td><td id="allowable-values"><ul><li>true</li><li>false</li></ul></td><td id="description">Enables or disables Token authentication when using SCRAM SASL Mechanisms<br/><br/><strong>This Property is only considered if </strong><strong>the [SASL Mechanism] Property is set to one of the following values: [SCRAM-SHA-512], [SCRAM-SHA-256]</strong></td></tr><tr><td id="name">SSL Context Service</td><td>ssl.context.service</td><td></td><td id="allowable-values"><strong>Controller Service API: </strong><br/>SSLContextService<br/><strong>Implementations: </strong><a href="../../../nifi-ssl-context-service-nar/1.19.1/org.apache.nifi.ssl.StandardRestrictedSSLContextService/index.html">StandardRestrictedSSLContextService</a><br/><a href="../../../nifi-ssl-context-service-nar/1.19.1/org.apache.nifi.ssl.StandardSSLContextService/index.html">StandardSSLContextService</a></td><td id="description">Service supporting SSL communication with Kafka brokers</td></tr><tr><td id="name">Separate By Key</td><td>separate-by-key</td><td id="default-value">false</td><td id="allowable-values"><ul><li>true</li><li>false</li></ul></td><td id="description">If true, two Records will only be added to the same FlowFile if both of the Kafka Messages have identical keys.</td></tr><tr><td id="name"><strong>Offset Reset</strong></td><td>auto.offset.reset</td><td id="default-value">latest</td><td id="allowable-values"><ul><li>earliest <img src="../../../../../html/images/iconInfo.png" alt="Automatically reset the offset to the earliest offset" title="Automatically reset the offset to the earliest offset"></img></li><li>latest <img src="../../../../../html/images/iconInfo.png" alt="Automatically reset the offset to the latest offset" title="Automatically reset the offset to the latest offset"></img></li><li>none <img src="../../../../../html/images/iconInfo.png" alt="Throw exception to the consumer if no previous offset is found for the consumer's group" title="Throw exception to the consumer if no previous offset is found for the consumer's group"></img></li></ul></td><td id="description">Allows you to manage the condition when there is no initial offset in Kafka or if the current offset does not exist any more on the server (e.g. because that data has been deleted). Corresponds to Kafka's 'auto.offset.reset' property.</td></tr><tr><td id="name">Message Header Encoding</td><td>message-header-encoding</td><td id="default-value">UTF-8</td><td id="allowable-values"></td><td id="description">Any message header that is found on a Kafka message will be added to the outbound FlowFile as an attribute. This property indicates the Character Encoding to use for deserializing the headers.</td></tr><tr><td id="name">Max Poll Records</td><td>max.poll.records</td><td id="default-value">10000</td><td id="allowable-values"></td><td id="description">Specifies the maximum number of records Kafka should return in a single poll.</td></tr><tr><td id="name"><strong>Communications Timeout</strong></td><td>Communications Timeout</td><td id="default-value">60 secs</td><td id="allowable-values"></td><td id="description">Specifies the timeout that the consumer should use when communicating with the Kafka Broker</td></tr></table><h3>Dynamic Properties: </h3><p>Supports Sensitive Dynamic Properties: <strong>No</strong></p><p>Dynamic Properties allow the user to specify both the name and value of a property.<table id="dynamic-properties"><tr><th>Name</th><th>Value</th><th>Description</th></tr><tr><td id="name">The name of a Kafka configuration property.</td><td id="value">The value of a given Kafka configuration property.</td><td>These properties will be added on the Kafka configuration after loading any provided configuration properties. In the event a dynamic property represents a property that was already set, its value will be ignored and WARN message logged. For the list of available Kafka properties please refer to: http://kafka.apache.org/documentation.html#configuration.<br/><strong>Supports Expression Language: true (will be evaluated using variable registry only)</strong></td></tr></table></p><h3>Relationships: </h3><table id="relationships"><tr><th>Name</th><th>Description</th></tr><tr><td>success</td><td>FlowFiles received from Kafka. Depending on demarcation strategy it is a flow file per message or a bundle of messages grouped by topic and partition.</td></tr><tr><td>parse.failure</td><td>If a message from Kafka cannot be parsed using the configured Record Reader, the contents of the message will be routed to this Relationship as its own individual FlowFile.</td></tr></table><h3>Reads Attributes: </h3>None specified.<h3>Writes Attributes: </h3><table id="writes-attributes"><tr><th>Name</th><th>Description</th></tr><tr><td>record.count</td><td>The number of records received</td></tr><tr><td>mime.type</td><td>The MIME Type that is provided by the configured Record Writer</td></tr><tr><td>kafka.partition</td><td>The partition of the topic the records are from</td></tr><tr><td>kafka.timestamp</td><td>The timestamp of the message in the partition of the topic.</td></tr><tr><td>kafka.topic</td><td>The topic records are from</td></tr></table><h3>State management: </h3>This component does not store state.<h3>Restricted: </h3>This component is not restricted.<h3>Input requirement: </h3>This component does not allow an incoming relationship.<h3>System Resource Considerations:</h3>None specified.<h3>See Also:</h3><p><a href="../org.apache.nifi.processors.kafka.pubsub.ConsumeKafka_2_6/index.html">ConsumeKafka_2_6</a>, <a href="../org.apache.nifi.processors.kafka.pubsub.PublishKafka_2_6/index.html">PublishKafka_2_6</a>, <a href="../org.apache.nifi.processors.kafka.pubsub.PublishKafkaRecord_2_6/index.html">PublishKafkaRecord_2_6</a></p></body></html>