Hi Prasanth,

Take a look at the Record Writer that you’re using with ConsumeKafkaRecord. 
There’s a property name “Suppress Null Values.” You’ll want to set that to 
“Suppress Missing Values.” That should give you what you’re looking for.

Thanks
-Mark


On May 19, 2022, at 7:53 AM, Prasanth M Sasidharan 
<prasha...@gmail.com<mailto:prasha...@gmail.com>> wrote:

Hello Team,

I am using ConsumeKafkaRecord_2_0 1.15.3 processor in Nifi to consume JSON data 
from Kafka Topic.

My issue is that the consumeKafka output matches the schema of both records and 
adds the missing tags in the JSON with null value .

Eg:
[
{
"acknowledged": "0",
"internal_last": "2022-04-26 15:40:00",
"specific_probcause": "no associated text",
"poll": "0",
"type": "1",
"probable_cause": "no associated text",
"last_occurrence": "2022-04-26 15:40:00",
"service": "default",
                "node": "re0",
"site_id": "no-siteid",
"device_class": "juniperjunosrtr",
"location": " ",
"network_first_time": "2022-04-26 15:40:00",
"agent": null,
"nodqqe": null
},
{
"acknowledged": "0",
"internal_last": "2022-04-26 15:40:00",
"specific_probcause": "no associated text",
"poll": "0",
"type": "1",
"probable_cause": " no associated text",
"node": null,
"last_occurrence": "2022-04-26 15:40:00",
"service": "default",
"site_id": "no-siteid",
"device_class": "juniperjunosrtr4",
"location": " ",
"network_first_time": "2022-04-26 15:40:00",
"agent": "test1",
"nodqqe": "ie-0"
}
]

In the above output the tags highlighted in RED are automatically inserted by 
the consumeKafkaRecord Processor. I assume that this is being done to match the 
schema of both the records. Is there a way to disable this? I would need the 
record as it is.
I am performing a header check after this step and due to the presence of this 
null value in the record, my header check isnt failing.

Any help would be much appreciated



--
Live every day as if it were your last, because one of these days, it will be.

Regards,

Prasanth M Sasidharan

Reply via email to