Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Getmongo processor failure case

avatar
Explorer

I am using the GetMongo processor to query a mongoDB for a particular key value pair and if the data is found then I want to log that But if the data is not found in the DB then I want to use the same key value pair (already present in the attributes of each flow file) that is failed and input into the next processor how can I approach this issue.

2 REPLIES 2

avatar

@Fanxxx, the first question would be if your GetMongo writes the flowfile in a queue when nothing was found in the DB, or does it log something in the Bulletin Board?

If a flowfile gets generated and sent to the failed queue, you can link that queue to your next processor and using the NiFi's Expression Language, you can perform any action you desire.

However, if nothing gets sent in the failure queue, you will need to create something else. You would need an InvokeHTTP in which you call NiFi' REST Api and extract the Bulletin Board Errors. You then filter out the messages generated by your GetMongo Processor (using it's unique ID) and proceed by extracting what you need out of it. If within your error message you will have all your necessary information, you can extract that information and save it as attributes, send then the flowfile to further processing and process it using NiFi's Expression Language. If the required information is not present in your error message, you will need to extract the query you tried to perform and extract the required information from there. Next, you will basically use the same logic overall, extract the information as attributes and send them down the stream to further processing using NiFi's EL.

NiFi's Expression Language: https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html
NiFi's REST API: https://nifi.apache.org/docs/nifi-docs/rest-api/index.html

avatar
Explorer

Hi @cotopaul ,

Thanks for the input, can you help on how to setup the invokeHTTP processor and how to fetch all the queues that we were not able to find in the Mongo DB.