blob: 961afef60519d25251336a4c45d4ae15e1688a23 [file] [log] [blame]
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"></meta><title>PublishKafkaRecord_2_0</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;">PublishKafkaRecord_2_0</h1><h2>Description: </h2><p>Sends the contents of a FlowFile as individual records to Apache Kafka using the Kafka 2.0 Producer API. The contents of the FlowFile are expected to be record-oriented data that can be read by the configured Record Reader. The complementary NiFi processor for fetching messages is ConsumeKafkaRecord_2_0.</p><p><a href="additionalDetails.html">Additional Details...</a></p><h3>Tags: </h3><p>Apache, Kafka, Record, csv, json, avro, logs, Put, Send, Message, PubSub, 2.0</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">A comma-separated list of known Kafka Brokers in the format &lt;host&gt;:&lt;port&gt;<br/><strong>Supports Expression Language: true (will be evaluated using variable registry only)</strong></td></tr><tr><td id="name"><strong>Topic Name</strong></td><td>topic</td><td></td><td id="allowable-values"></td><td id="description">The name of the Kafka Topic to publish to.<br/><strong>Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)</strong></td></tr><tr><td id="name"><strong>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.0/org.apache.nifi.cef.CEFReader/index.html">CEFReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.0/org.apache.nifi.syslog.Syslog5424Reader/index.html">Syslog5424Reader</a><br/><a href="../../../nifi-scripting-nar/1.19.0/org.apache.nifi.record.script.ScriptedReader/index.html">ScriptedReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.0/org.apache.nifi.syslog.SyslogReader/index.html">SyslogReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.0/org.apache.nifi.csv.CSVReader/index.html">CSVReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.0/org.apache.nifi.grok.GrokReader/index.html">GrokReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.0/org.apache.nifi.json.JsonTreeReader/index.html">JsonTreeReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.0/org.apache.nifi.xml.XMLReader/index.html">XMLReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.0/org.apache.nifi.avro.AvroReader/index.html">AvroReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.0/org.apache.nifi.lookup.ReaderLookup/index.html">ReaderLookup</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.0/org.apache.nifi.windowsevent.WindowsEventLogReader/index.html">WindowsEventLogReader</a><br/><a href="../../../nifi-parquet-nar/1.19.0/org.apache.nifi.parquet.ParquetReader/index.html">ParquetReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.0/org.apache.nifi.json.JsonPathReader/index.html">JsonPathReader</a></td><td id="description">The Record Reader to use for incoming FlowFiles</td></tr><tr><td id="name"><strong>Record 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.0/org.apache.nifi.lookup.RecordSetWriterLookup/index.html">RecordSetWriterLookup</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.0/org.apache.nifi.xml.XMLRecordSetWriter/index.html">XMLRecordSetWriter</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.0/org.apache.nifi.text.FreeFormTextRecordSetWriter/index.html">FreeFormTextRecordSetWriter</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.0/org.apache.nifi.csv.CSVRecordSetWriter/index.html">CSVRecordSetWriter</a><br/><a href="../../../nifi-scripting-nar/1.19.0/org.apache.nifi.record.script.ScriptedRecordSetWriter/index.html">ScriptedRecordSetWriter</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.0/org.apache.nifi.avro.AvroRecordSetWriter/index.html">AvroRecordSetWriter</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.0/org.apache.nifi.json.JsonRecordSetWriter/index.html">JsonRecordSetWriter</a><br/><a href="../../../nifi-parquet-nar/1.19.0/org.apache.nifi.parquet.ParquetRecordSetWriter/index.html">ParquetRecordSetWriter</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>Use Transactions</strong></td><td>use-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 provide Transactional guarantees when communicating with Kafka. If there is a problem sending data to Kafka, and this property is set to false, then the messages that have already been sent to Kafka will continue on and be delivered to consumers. If this is set to true, then the Kafka transaction will be rolled back so that those messages are not available to consumers. Setting this to true requires that the &lt;Delivery Guarantee&gt; property be set to "Guarantee Replicated Delivery."</td></tr><tr><td id="name"><strong>Failure Strategy</strong></td><td>Failure Strategy</td><td id="default-value">Route to Failure</td><td id="allowable-values"><ul><li>Route to Failure <img src="../../../../../html/images/iconInfo.png" alt="When unable to publish a FlowFile to Kafka, the FlowFile will be routed to the 'failure' relationship." title="When unable to publish a FlowFile to Kafka, the FlowFile will be routed to the 'failure' relationship."></img></li><li>Rollback <img src="../../../../../html/images/iconInfo.png" alt="When unable to publish a FlowFile to Kafka, the FlowFile will be placed back on the top of its queue so that it will be the next FlowFile tried again. For dataflows where ordering of FlowFiles is important, this strategy can be used along with ensuring that the each processor in the dataflow uses only a single Concurrent Task." title="When unable to publish a FlowFile to Kafka, the FlowFile will be placed back on the top of its queue so that it will be the next FlowFile tried again. For dataflows where ordering of FlowFiles is important, this strategy can be used along with ensuring that the each processor in the dataflow uses only a single Concurrent Task."></img></li></ul></td><td id="description">Dictates how the processor handles a FlowFile if it is unable to publish the data to Kafka</td></tr><tr><td id="name">Transactional Id Prefix</td><td>transactional-id-prefix</td><td></td><td id="allowable-values"></td><td id="description">When Use Transaction is set to true, KafkaProducer config 'transactional.id' will be a generated UUID and will be prefixed with this string.<br/><strong>Supports Expression Language: true (will be evaluated using variable registry only)</strong></td></tr><tr><td id="name"><strong>Delivery Guarantee</strong></td><td>acks</td><td id="default-value">Guarantee Replicated Delivery</td><td id="allowable-values"><ul><li>Best Effort <img src="../../../../../html/images/iconInfo.png" alt="FlowFile will be routed to success after successfully sending the content to a Kafka node, without waiting for any acknowledgment from the node at all. This provides the best performance but may result in data loss." title="FlowFile will be routed to success after successfully sending the content to a Kafka node, without waiting for any acknowledgment from the node at all. This provides the best performance but may result in data loss."></img></li><li>Guarantee Single Node Delivery <img src="../../../../../html/images/iconInfo.png" alt="FlowFile will be routed to success if the message is received by a single Kafka node, whether or not it is replicated. This is faster than &lt;Guarantee Replicated Delivery&gt; but can result in data loss if a Kafka node crashes" title="FlowFile will be routed to success if the message is received by a single Kafka node, whether or not it is replicated. This is faster than &lt;Guarantee Replicated Delivery&gt; but can result in data loss if a Kafka node crashes"></img></li><li>Guarantee Replicated Delivery <img src="../../../../../html/images/iconInfo.png" alt="FlowFile will be routed to failure unless the message is replicated to the appropriate number of Kafka Nodes according to the Topic configuration" title="FlowFile will be routed to failure unless the message is replicated to the appropriate number of Kafka Nodes according to the Topic configuration"></img></li></ul></td><td id="description">Specifies the requirement for guaranteeing that a message is sent to Kafka. Corresponds to Kafka's 'acks' property.</td></tr><tr><td id="name">Attributes to Send as Headers (Regex)</td><td>attribute-name-regex</td><td></td><td id="allowable-values"></td><td id="description">A Regular Expression that is matched against all FlowFile attribute names. Any attribute whose name matches the regex will be added to the Kafka messages as a Header. If not specified, no FlowFile attributes will be added as headers.</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">For any attribute that is added as a message header, as configured via the &lt;Attributes to Send as Headers&gt; property, this property indicates the Character Encoding to use for serializing the headers.</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 <img src="../../../../../html/images/iconInfo.png" alt="PLAINTEXT" title="PLAINTEXT"></img></li><li>SSL <img src="../../../../../html/images/iconInfo.png" alt="SSL" title="SSL"></img></li><li>SASL_PLAINTEXT <img src="../../../../../html/images/iconInfo.png" alt="SASL_PLAINTEXT" title="SASL_PLAINTEXT"></img></li><li>SASL_SSL <img src="../../../../../html/images/iconInfo.png" alt="SASL_SSL" title="SASL_SSL"></img></li></ul></td><td id="description">Protocol used to communicate with brokers. Corresponds to Kafka's '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="The mechanism for authentication via Kerberos. The principal and keytab must be provided to the processor by using a Keytab Credential service, or by specifying the properties directly in the processor." title="The mechanism for authentication via Kerberos. The principal and keytab must be provided to the processor by using a Keytab Credential service, or by specifying the properties directly in the processor."></img></li><li>PLAIN <img src="../../../../../html/images/iconInfo.png" alt="The mechanism for authentication via username and password. The username and password properties must be populated when using this mechanism." title="The mechanism for authentication via username and password. The username and password properties must be populated when using this mechanism."></img></li><li>SCRAM-SHA-256 <img src="../../../../../html/images/iconInfo.png" alt="The Salted Challenge Response Authentication Mechanism using SHA-256. The username and password properties must be set when using this mechanism." title="The Salted Challenge Response Authentication Mechanism using SHA-256. The username and password properties must be set when using this mechanism."></img></li><li>SCRAM-SHA-512 <img src="../../../../../html/images/iconInfo.png" alt="The Salted Challenge Response Authentication Mechanism using SHA-512. The username and password properties must be set when using this mechanism." title="The Salted Challenge Response Authentication Mechanism using SHA-512. The username and password properties must be set when using this mechanism."></img></li></ul></td><td id="description">The SASL mechanism to use for authentication. Corresponds to Kafka's '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.0/org.apache.nifi.kerberos.KeytabCredentialsService/index.html">KeytabCredentialsService</a></td><td id="description">Specifies the Kerberos Credentials Controller Service that should be used for authenticating 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 file.This can be defined either in Kafka's JAAS config or in Kafka's config. Corresponds to Kafka's 'security.protocol' property.It is ignored unless one of the SASL options of the &lt;Security Protocol&gt; are selected.<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">The Kerberos principal that will be used to connect to brokers. If not set, it is expected to set a JAAS configuration file in the JVM properties defined in the bootstrap.conf file. This principal will be set into 'sasl.jaas.config' Kafka's property.<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">The Kerberos keytab that will be used to connect to brokers. If not set, it is expected to set a JAAS configuration file in the JVM properties defined in the bootstrap.conf file. This principal will be set into 'sasl.jaas.config' Kafka's property.<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">The username when the SASL Mechanism is PLAIN or SCRAM-SHA-256/SCRAM-SHA-512<br/><strong>Supports Expression Language: true (will be evaluated using variable registry only)</strong></td></tr><tr><td id="name">Password</td><td>sasl.password</td><td></td><td id="allowable-values"></td><td id="description">The password for the given username when the SASL Mechanism is PLAIN or SCRAM-SHA-256/SCRAM-SHA-512<br/><strong>Sensitive Property: true</strong><br/><strong>Supports Expression Language: true (will be evaluated using variable registry only)</strong></td></tr><tr><td id="name">Token Auth</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">When SASL Mechanism is SCRAM-SHA-256 or SCRAM-SHA-512, this property indicates if token authentication should be used.</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.0/org.apache.nifi.ssl.StandardRestrictedSSLContextService/index.html">StandardRestrictedSSLContextService</a><br/><a href="../../../nifi-ssl-context-service-nar/1.19.0/org.apache.nifi.ssl.StandardSSLContextService/index.html">StandardSSLContextService</a></td><td id="description">Specifies the SSL Context Service to use for communicating with Kafka.</td></tr><tr><td id="name">Message Key Field</td><td>message-key-field</td><td></td><td id="allowable-values"></td><td id="description">The name of a field in the Input Records that should be used as the Key for the Kafka message.<br/><strong>Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)</strong></td></tr><tr><td id="name"><strong>Max Request Size</strong></td><td>max.request.size</td><td id="default-value">1 MB</td><td id="allowable-values"></td><td id="description">The maximum size of a request in bytes. Corresponds to Kafka's 'max.request.size' property and defaults to 1 MB (1048576).</td></tr><tr><td id="name"><strong>Acknowledgment Wait Time</strong></td><td>ack.wait.time</td><td id="default-value">5 secs</td><td id="allowable-values"></td><td id="description">After sending a message to Kafka, this indicates the amount of time that we are willing to wait for a response from Kafka. If Kafka does not acknowledge the message within this time period, the FlowFile will be routed to 'failure'.</td></tr><tr><td id="name"><strong>Max Metadata Wait Time</strong></td><td>max.block.ms</td><td id="default-value">5 sec</td><td id="allowable-values"></td><td id="description">The amount of time publisher will wait to obtain metadata or wait for the buffer to flush during the 'send' call before failing the entire 'send' call. Corresponds to Kafka's 'max.block.ms' property<br/><strong>Supports Expression Language: true (will be evaluated using variable registry only)</strong></td></tr><tr><td id="name">Partitioner class</td><td>partitioner.class</td><td id="default-value">DefaultPartitioner</td><td id="allowable-values"><ul><li>RoundRobinPartitioner <img src="../../../../../html/images/iconInfo.png" alt="Messages will be assigned partitions in a round-robin fashion, sending the first message to Partition 1, the next Partition to Partition 2, and so on, wrapping as necessary." title="Messages will be assigned partitions in a round-robin fashion, sending the first message to Partition 1, the next Partition to Partition 2, and so on, wrapping as necessary."></img></li><li>DefaultPartitioner <img src="../../../../../html/images/iconInfo.png" alt="Messages will be assigned to random partitions." title="Messages will be assigned to random partitions."></img></li><li>RecordPath Partitioner <img src="../../../../../html/images/iconInfo.png" alt="Interprets the &lt;Partition&gt; property as a RecordPath that will be evaluated against each Record to determine which partition the Record will go to. All Records that have the same value for the given RecordPath will go to the same Partition." title="Interprets the &lt;Partition&gt; property as a RecordPath that will be evaluated against each Record to determine which partition the Record will go to. All Records that have the same value for the given RecordPath will go to the same Partition."></img></li><li>Expression Language Partitioner <img src="../../../../../html/images/iconInfo.png" alt="Interprets the &lt;Partition&gt; property as Expression Language that will be evaluated against each FlowFile. This Expression will be evaluated once against the FlowFile, so all Records in a given FlowFile will go to the same partition." title="Interprets the &lt;Partition&gt; property as Expression Language that will be evaluated against each FlowFile. This Expression will be evaluated once against the FlowFile, so all Records in a given FlowFile will go to the same partition."></img></li></ul></td><td id="description">Specifies which class to use to compute a partition id for a message. Corresponds to Kafka's 'partitioner.class' property.</td></tr><tr><td id="name">Partition</td><td>partition</td><td></td><td id="allowable-values"></td><td id="description">Specifies which Partition Records will go to. How this value is interpreted is dictated by the &lt;Partitioner class&gt; property.<br/><strong>Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)</strong></td></tr><tr><td id="name"><strong>Compression Type</strong></td><td>compression.type</td><td id="default-value">none</td><td id="allowable-values"><ul><li>none</li><li>gzip</li><li>snappy</li><li>lz4</li></ul></td><td id="description">This parameter allows you to specify the compression codec for all data generated by this producer.</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 for which all content was sent to Kafka.</td></tr><tr><td>failure</td><td>Any FlowFile that cannot be sent to Kafka will be routed to this Relationship</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>msg.count</td><td>The number of messages that were sent to Kafka for this FlowFile. This attribute is added only to FlowFiles that are routed to success.</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 requires an incoming relationship.<h3>System Resource Considerations:</h3>None specified.<h3>See Also:</h3><p><a href="../org.apache.nifi.processors.kafka.pubsub.PublishKafka_2_0/index.html">PublishKafka_2_0</a>, <a href="../org.apache.nifi.processors.kafka.pubsub.ConsumeKafka_2_0/index.html">ConsumeKafka_2_0</a>, <a href="../org.apache.nifi.processors.kafka.pubsub.ConsumeKafkaRecord_2_0/index.html">ConsumeKafkaRecord_2_0</a></p></body></html>