I have started a Nifi process(Consume Kafka) and connected it to a topic. It is running but I am not able to (don\'t know) where can I view the messages?
ConsumeKafka processor runs and generates flowfile for each message. Only when you connect a processor to other components like another processor or an output port, will you be able to visualize the data being moved through.
For starters you can try this:
ConsumeKafka
with LogAttribute
or any other processor for
that matter.LogAttribute
processor.ConsumeKafka
, all the received messages from the
configured Kafka topic will be queued up in the form of flowfiles.List Queue
and you can access the queue.View
button and you
can see the data.This whole explanation of "viewing" the Kafka message is just to help you in debugging and get started with NiFi. Ideally you would be using other NiFi processors to work out your usecase.
Example
You receive messages from Kafka and wants to write it to MongoDB, so you can have the flow as:
Note:
There are record based processors like ConsumeKafkaRecord
and PutMongoRecord
but they are basically doing the same thing with more enhancements. Since you're new to this, I have suggested a simple flow. You can find details about the Record
based processors here and try that.
You might need to consume messages --from-beginning
if those messages have been consumed before (and therefore offsets have been committed).
On GetKafka processor, there is a property Auto Offset Reset which should be set to smallest which is the equivalent of --from-beginning
in Kafka Console Consumer.