- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Count number of incoming flow files
- Labels:
-
Apache NiFi
Created ‎10-18-2023 10:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have to make a flow where I want to check that two Mongo DBs are in sync so everyday I have to compare the count of records that are being inserted into both the DBs if there is a discrepancy I want to transfer the records from the main DB to the DB which doesn't have it. Both DBs have a created AT key which has the date when the record was added. I want to achieve this through apache NIFI.
Created ‎10-18-2023 11:53 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Fanxxx,
How I would do the first POC:
1) GetMongoRecord: execute the count on the first table. Using the property "Query Output Attribute" you save that value directly as an attribute.
2) connected to the success queue another GetMongoRecord: execute the count on the second table. Using the property "Query Output Attribute" you save that value directly as an attribute.
3) connected to the success queue an RouteOnAttribute: here you define a rules --> if count1=count2, do what you want to do, otherwise call the logic for the insert, as you said. (using NiFi Expression language: ${attribute1:equals(${attribute2})} )
