Member since
12-21-2023
12
Posts
7
Kudos Received
0
Solutions
12-19-2024
11:07 PM
1 Kudo
@enam I see you have used the correct InvokeHTTP processor which is used to send API requests and handle responses, including error codes 400, 500 etc. Configuration for InvokeHTTP: Set Required Properties: HTTP Method: POST Remote URL: http://192.168.200.162:2031/nostroliquidity........ Return Code: Ensure Success Codes includes only 2xx responses by default. To enable Error Responses add the following settings: "Always Output Response": Set to true. Output Response Attributes: Include attributes such as status.code and status.message to capture response metadata. This ensures that the processor outputs responses regardless of status code. Now route Responses Based on Status Code Use the RouteOnAttribute processor to differentiate between success and error responses add two conditions: Success Route: Check for status.code >= 200 AND status.code < 300. Error Route: Check for status.code >= 400. Connect the InvokeHTTP processor's Response relationship to the RouteOnAttribute processor. To write Responses to Appropriate Locations Use a PutFile or PutHDFS processor for both success and error routes: Success Route: Write successful responses to a specific directory. Error Route: Write error responses 400, 500 to a separate directory. Include response details for debugging. GenerateFlowFile --> InvokeHTTP --> RouteOnAttribute --> [Success] PutFile --> [Error] PutFile Important Configuration Notes Configure Failure Handling in InvokeHTTP: Connect the InvokeHTTP processor’s Original relationship to a LogMessage processor or another flow to avoid losing the original flowfile. Customize Filenames or Attributes: Use UpdateAttribute to set filenames or directories dynamically based on attributes like status.code or status.message. Capture Full API Responses: Ensure that Response Body from the API is written as the content of the output file. Can you run the above flow and revert Happy hadooping
... View more
10-22-2024
05:23 AM
Hello samsal , I'm also doing the same thing and I tried with your approach also but still I'm getting the error like java.lang.IllegalStateException: closed Can you plz help me in this these are my configuration which i have done this preview which i got And the configuration:- and the enitre pipeline
... View more
07-02-2024
01:00 PM
1 Kudo
@enam Have a slight mistake in my NiFi Expression Language (NEL) statement in my above post. Should be as follows instead: Property = filename
Value = ${filename:substringBeforeLast('.')}-${UUID()}.${filename:substringAfterLast('.')} Thanks, Matt
... View more
02-18-2024
09:36 PM
1 Kudo
Hi, The processor sure changed in 2.0 from before , so few things I will check : - Make sure the Request Bondy Enabled is set to true - Make sure the Request Content-Type is set to : multipart/form-data - Make sure to set the Request Multipart Form-Data Name to: file - Once you set the property above, the property Request Multipart Form-Data Filename Enabled becomes visible , make sure it sets to true and it will use the filename attribute in the Content-Disposition header. - Make sure to set the Response Generation Required property to: true (default false) - Finally, I dont think you need the Content-Disposition dynamic property since its already been set through the above properties. I honestly dont like how in 2.0 there is a lot of visibility dependency with some of the properties where their visibility depends on setting the value of others. It makes it confusing specially when you read the documentation and struggle to find all the mentioned properties until you set the right values. I would rather if its all showing or at least less visibility dependency on some of them. Let me know if that works for you or not. If it does, please accept solution. Thanks
... View more
01-14-2024
09:14 PM
Hi @enam , The concept of templates has been removed in 2.0 per the following article: https://medium.com/cloudera-inc/getting-ready-for-apache-nifi-2-0-5a5e6a67f450 You can either use the Nifi registry to share files as the article suggest. You can also right click on a given process group and select Download Flow Definition which will save the process group in json format. If that helps please accept solution. Thanks
... View more
01-11-2024
01:41 PM
1 Kudo
@enam Looks like you have a bad file filter regex in your listSFTP processor configuration. .*file.*\.xls Above looks for any character for 1 or more characters until is finds the last occurrence of string "file" followed by any character for as many characters until last occurrence of string ".xls". However, all your filenames start with "file" and have no characters before it. Try modifying your file filter regex by removing the ".*" before "file": file.*\.xls Right click on processor, select "view state", and then "clear state". Then start the listSFTP processor again to see if generated NiFi FlowFiles for each file on your SFTP server. If you found any of the suggestions/solutions provided helped you with your issue, please take a moment to login and click "Accept as Solution" on one or more of them that helped. Thank you, Matt
... View more
01-03-2024
06:50 AM
@enam I cant see the entire configuration of the second InvokeHTTP so I am not sure if you are passing those new attributes into the HTTP URL. If you are not doing that, I think the solution you are looking for is to have the AttributesToJson set Destination to FlowFile Content. Then when you post that to invokeHttp, those values are seen as the post content.
... View more