Member since
07-29-2020
311
Posts
92
Kudos Received
90
Solutions
My Accepted Solutions
Title | Views | Posted |
---|---|---|
56 | 09-27-2023 07:20 AM | |
71 | 09-16-2023 07:20 AM | |
98 | 09-12-2023 08:55 AM | |
130 | 09-08-2023 06:35 AM | |
168 | 08-31-2023 03:26 PM |
09-30-2023
07:24 AM
Hi @piyush7829 , I'm assuming you are getting the json {" match_id" : 789456} response from the GetMongo processor, after this you are directly using ReplaceText processor with the replace value: match_id=${match_id:urlEncode()} This replace value is using flowfile attribute ${match_id}, but I dont see in your flow where this attribute is defined! I think you are missing a step to extract this attribute between GetMongo & ReplaceText processors. If the response is Json then you can use EvaluateJsonPath processor to extract the match_id attribute : After you connect the "match" rel from the above processor to the ReplaceText processor , the replacement value should work. If that helps please accept solution. Thanks
... View more
09-29-2023
06:14 AM
@RRG, Not sure I understand. Can you please elaborate?
... View more
09-28-2023
07:32 PM
@RRG, In the ExtractText you can use the following pattern to get only valid files: (^((?!README|LICENSE|NOTICE).)*$) This pattern will exclude any text containing readme, license or notice in it. Hope that helps.
... View more
09-28-2023
11:30 AM
1 Kudo
Hi @sarithe , I dont think you can achieve what you want using ControlRate processor since this processor is going to allow flowfile to go downstream when MaximumRate is reached besides this processor doesnt support statefulness to control Max Rate Property over multiple files. Instead I would suggest taking advantage of the UpdateAttribute processor since it supports statefulness over a given attribute. You can use a stateful attribute as a counter that increments\decrements when the flowfiles are being passed through and process accordingly. Then you can check the counter using RouteOnAttribute to see if its less than your threshold (2 in your case) to proceed with processing the flowfiles and if the counter has reached the threshold, the flowfiles will loop indefinitely until flowfiles being processed are done after which the counter is decremented. I was able to do that with simple flow to illustrate , but you can use the same pattern to work with your case. The flow I created will do the following: 1- After getting the input, use UpdateAttribute to set the isProcessed flag to 0 2- Use another UpdateAttribute where Store State is set to "Store State Locally". This processor will be used to define rules that will increment\decrement flowfileCounter based on the isProcessed flag as follows: - isProcessed = 0 and flowfileCounter < 2 then flowfileCounter +=1 - isProcessed = 1 then flowfileCounter-=1 make sure to set the "Stateful Variables Initial Value" to 0 to initialize your counter. since it starts from 0 then 2ed flowfile will be increment the counter to 1 hence <2 3- Using RouteOnAttribute create two conditional relationship: - ProcessedRel : check if the isProcessed flag is set to 1 . This basically will route to end of the flow. You can terminate if no farther processing is needed. - NotProcessedAnd<2 : this will check if the flowfileCounter is less than 2 and flowfile isProcessed is set to 0 to which if true then flowfile will proceed to be processed. If none of the above condition is met, then you can use unmatched rel to loop back to the UpdateAttribute in step 2. 4- Once flowfile are processed use another UpdateAttribute to set the isProcessed flag to 1 and then point the success rel back to UpdateAttribute in step 2 to decrement the counter based on the defined rules. Here how my flow looks like: GenerateFlowFile: is to simulate creating the input and set the isProcessed flag to 0 on each flowfile (step 1 above) Update flowfileCounter stateful (UpdateAttribute - step2): used to define the rules for setting the stateful flowfileCounter: click Advanced to define Rules & Actions: Rule1 \ Action 1: Increment flowfileCounter if flowfile not processed and less than threshold Rule2 \ Action 2: decrement flowfileCounter if flowfile is processed RouteOnAttribute : Proceed if flowfile is not processed and threshold < 2 . Finish if is Processed set to 1, otherwise loop back to step 2 Do Something (ControlRate): this is just to simulate doing something with the flowfiles from the NotProcessedAnd<2 rel above. This where you process the next two flowfiles. Set isProcessed to 1 (UpdateAttribute -step 4): set the isProcessed flag to 1 and point the success rel back to UpdateAttribute step 2 to decrement the flowfile counter user Rule2. If someone think there is a better way please feel free to provide your input. If this helps please accept solution. Thanks
... View more
09-27-2023
07:20 AM
1 Kudo
@Abhiram-4455, Assuming you have the following input where you can have multiple records per CSV input: Name,class,grade,address,first_url,second_url
John,10th,A,New York,https://www.facebook.com,/brnds-coupons/offers
sam,9th,A,Dallas,www.google.com,www.amazon.com You can use the following processors to do your transformation: Where each processor is configured as the following: - ConvertRecord: is to convert from CSV format to JSON CSVReader: (use default settings) Note: you can adjust the "Value Separator" in case the CSV delimiter is different from ",". JSONRecorSertWriter: (use default settings) - JoltTransformationJSON: where "Jolt Specification" is set to the following: [
{
"operation": "shift",
"spec": {
"*": {
"*": "[&1].&",
"first_url": "[&1].url.&",
"second_url": "[&1].url.&"
}
}
}
] The output shouldlook like the following: [
{
"Name": "John",
"class": "10th",
"grade": "A",
"address": "New York",
"url": {
"first_url": "https://www.facebook.com",
"second_url": "/brnds-coupons/offers"
}
},
{
"Name": "sam",
"class": "9th",
"grade": "A",
"address": "Dallas",
"url": {
"first_url": "www.google.com",
"second_url": "www.amazon.com"
}
}
] if you need to process each record separately you can use SplitJson processor: Use the "split" relationship to get the split records. Hope that helps.
... View more
09-26-2023
11:44 AM
1 Kudo
Hi @Abhiram-4455 , The easiest way to do such transformation is to use ConvertRecord to convert the format from CSV format to JSON format, then you can use JoltTransformation processor to do the proper transformation to the final format that you need. To see an example of this please refer to the following post: https://community.cloudera.com/t5/Support-Questions/want-to-convert-csv-to-nested-json-using-nifi/td-p/224954 If that helps please accept solution. Thanks
... View more
09-18-2023
07:17 AM
1 Kudo
Hi @manishg , This has been asked before in a different way but you can implement the same method: https://community.cloudera.com/t5/Support-Questions/Wait-for-a-Flowfile-to-be-picked-only-after-the-previous/m-p/375890#M242696 If that helps please accept solution. Thanks
... View more
09-16-2023
07:20 AM
Hi @mr80132 , Something I noticed about your configuration for the "GenerateTableFetch" processor is that you are not setting any value for the "Maximum-value Columns". I think you need to set at least one column name that the processor will track the max value for and fetch anything that comes with value greater than the max. Please refer to the processor description: https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.12.1/org.apache.nifi.processors.standard.GenerateTableFetch/ if that helps please accept solution . Thanks
... View more
09-13-2023
06:19 AM
I dont think you can use PutSQL for this. Try ExecuteSQL or you might have to use ExecuteScript processor as other posts suggest: https://community.cloudera.com/t5/Support-Questions/Does-ExecuteSQL-processor-allow-to-execute-stored-procedure/m-p/158922 https://stackoverflow.com/questions/72348844/get-output-of-stored-procedure-using-putsql-in-nifi If that helps please accept solution. Thanks
... View more
09-12-2023
08:55 AM
1 Kudo
Hi @CommanderLaus , The easiest way I can think of is to use the ExtractText Processor where you define an attribute as dynamic property and assign the Regex as follows: I did only the first three fields but you can do the others the same way. If that helps please accept solution. Thanks
... View more