Skip to main content
Rishi_DE
Silver ⭐️
Jun 1, 2021 6:56 PM UTC
Solved

What is the difference between publishKafka and publishKafkaRecord processors in Apache NiFi

What is the difference between using the PublishKafka processor versus the PublishKafkaRecord processor when sending data from Apache NiFi to Kafka?

aakulov
aakulovAnswer
Platinum ⭐️
Jun 1, 2021 7:31 PM UTC

PublishKafka sends the entire flow file to Kafka as a single message. PublishKafkaRecord splits each "record" (e.g. row) in the flow file and sends each record as a message. 

 

References:

1. PublishKafka: https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-kafka-0-9-nar/1.6.0/org.apache.nifi.processors.kafka.pubsub.PublishKafka/

2. PublishKafkaRecord: https://nifi.apache.org/docs/nifi-docs/components/nifi-docs/components/org.apache.nifi/nifi-kafka-2-0-nar/1.9.0/org.apache.nifi.processors.kafka.pubsub.PublishKafkaRecord_2_0/index.html

 

3 replies

aakulov
Platinum ⭐️
aakulovAnswer
Platinum ⭐️
Jun 1, 2021 7:31 PM UTC

PublishKafka sends the entire flow file to Kafka as a single message. PublishKafkaRecord splits each "record" (e.g. row) in the flow file and sends each record as a message. 

 

References:

1. PublishKafka: https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-kafka-0-9-nar/1.6.0/org.apache.nifi.processors.kafka.pubsub.PublishKafka/

2. PublishKafkaRecord: https://nifi.apache.org/docs/nifi-docs/components/nifi-docs/components/org.apache.nifi/nifi-kafka-2-0-nar/1.9.0/org.apache.nifi.processors.kafka.pubsub.PublishKafkaRecord_2_0/index.html

 

Translate
Rishi_DE
Rishi_DEAuthor
Silver ⭐️
Jun 1, 2021 7:44 PM UTC

So if I have used JSON transformations on my data and each time 100 flow file are generated so I guess both will be equivalent ...

Translate
aakulov
Platinum ⭐️
Platinum ⭐️
Jun 1, 2021 7:56 PM UTC

If your files contain one record each, then yes, these NiFi processors will be equivalent.

Translate