Description:

Sends the contents of a FlowFile as a message to Apache Kafka. The messages to send may be individual FlowFiles or may be delimited, using a user-specified delimiter, such as a new-line.

Additional Details...

Tags:

Apache, Kafka, Put, Send, Message, PubSub

Properties:

In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.

NameDefault ValueAllowable ValuesDescription
Known BrokersA comma-separated list of known Kafka Brokers in the format <host>:<port>
Topic NameThe Kafka Topic of interest
Supports Expression Language: true
Partition StrategyRound Robin
  • Round Robin 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.
  • Random Messages will be assigned to random partitions.
  • User-Defined The <Partition> property will be used to determine the partition. All messages within the same FlowFile will be assigned to the same partition.
Specifies how messages should be partitioned when sent to Kafka
PartitionSpecifies which Kafka Partition to add the message to. If using a message delimiter, all messages in the same FlowFile will be sent to the same partition. If a partition is specified but is not valid, then all messages within the same FlowFile will use the same partition but it remains undefined which partition is used.
Supports Expression Language: true
Kafka KeyThe Key to use for the Message
Supports Expression Language: true
Delivery Guarantee0
  • Best Effort FlowFile will be routed to success after successfully writing the content to a Kafka node, without waiting for a response. This provides the best performance but may result in data loss.
  • Guarantee Single Node Delivery 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 <Guarantee Replicated Delivery> but can result in data loss if a Kafka node crashes
  • Guarantee Replicated Delivery FlowFile will be routed to failure unless the message is replicated to the appropriate number of Kafka Nodes according to the Topic configuration
Specifies the requirement for guaranteeing that a message is sent to Kafka
Message DelimiterSpecifies the delimiter to use for splitting apart multiple messages within a single FlowFile. If not specified, the entire content of the FlowFile will be used as a single message. If specified, the contents of the FlowFile will be split on this delimiter and each section sent as a separate Kafka message. Note that if messages are delimited and some messages for a given FlowFile are transferred successfully while others are not, the messages will be split into individual FlowFiles, such that those messages that were successfully sent are routed to the 'success' relationship while other messages are sent to the 'failure' relationship.
Supports Expression Language: true
Max Buffer Size5 MBThe maximum amount of data to buffer in memory before sending to Kafka
Max Record Size1 MBThe maximum size that any individual record can be.
Communications Timeout30 secsThe amount of time to wait for a response from Kafka before determining that there is a communications error
Batch Size200The number of messages to send in one batch. The producer will wait until either this number of messages are ready to send or "Queue Buffering Max Time" is reached.
Queue Buffering Max Time5 secsMaximum time to buffer data before sending to Kafka. For example a setting of 100 ms will try to batch together 100 milliseconds' worth of messages to send at once. This will improve throughput but adds message delivery latency due to the buffering.
Compression Codecnone
  • None Compression will not be used for any topic.
  • GZIP Compress messages using GZIP
  • Snappy Compress messages using Snappy
This parameter allows you to specify the compression codec for all data generated by this producer.
Client NameNiFi-mock-processorClient Name to use when communicating with Kafka

Dynamic Properties:

Dynamic Properties allow the user to specify both the name and value of a property.

NameValueDescription
The name of a Kafka configuration property.The value of a given Kafka configuration property.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 as part of the static properties, its value wil be overriden with warning message describing the override. For the list of available Kafka properties please refer to: http://kafka.apache.org/documentation.html#configuration.

Relationships:

NameDescription
failureAny FlowFile that cannot be sent to Kafka will be routed to this Relationship
successAny FlowFile that is successfully sent to Kafka will be routed to this Relationship

Reads Attributes:

None specified.

Writes Attributes:

None specified.