Support Questions
Find answers, ask questions, and share your expertise

Parsing incoming Json message coming from a NiFi Stream into Hbase table

Parsing incoming Json message coming from a NiFi Stream into Hbase table

New Contributor

Hi All,

I am getting a Stream of message from a Kafka Topic in NiFi which I am reading via a consumer process. Message is in the format of json (dummy json values, json format same as original one):

{"schema":{"type":"struct","name":"emp_table","fields":[{"field":"emp_id","type":"string"},{"field":"emp_name","type":"String"},{"field":"city","type":"string"},{"field":"emp_sal","type":"string"},{"field":"manager_name","type":"string"}]},"payload":{"emp_id":"1","emp_name":"abc","city":"NYK","emp_sal":"100000","manager_name":"xyz"}}

As u can see here actual table name is under Schema and column value is under payload. I am able to parse column values and put into Hbase table by using EvaluateJsonPath and PutHBaseJson processors in NiFi.

97484-puthbasejson.jpg

What I am able to achieve is manually putting table name and rowid. But my issue is I want to fetch tablename(in above example emp_table) and a rowid (in above example emp_id) from the json and at runtime provide those values to PutHbaseJson processor in NiFi.

Please help me in the above query. Thanks a lot


evaluatejsonpath.jpg
1 REPLY 1
Highlighted

Re: Parsing incoming Json message coming from a NiFi Stream into Hbase table

Explorer

Hi @Apurw Srivastava,

table name is expression enabled, you can update attribute first and set the attribute with the desired table name. you can then reference the attribute as table name in the PutHbaseJson processor