Created 08-31-2022 02:14 AM
Hi,
I want to save the out put of the file after replace the text.when i put xml file for consumed NIFI replace the text and move xml file into processed folder,NIFI didn't change into original xml file,i just want to know during process what is the code which NIFI use.
Created 09-22-2022 06:24 AM
@ImranAhmed
Can you share a screenshot of your dataflow and the configuration of your replaceText processor?
You mention xml. Is your source File that you are trying to perform replace text on an XML format file?
If so, that is not a text based (ASCII) content file. In that case, your configured search value is probably not matching on anything and this nothing gets changed in the original content binary content.
NiFi is a content agnostic application. This means that NiFi can ingest any type of data. It does this by wrapping that content in to what NiFi calls a FlowFile. A FlowFile consists of two parts:
1. FlowFile metadata/attributes - Stored in the NiFi flowfile_repository. It contains details about the content such as filename, size of content, location of stored content, and any other attributes added by NiFi components (processors, controller services, etc) as the FlowFile traverse these components in your dataflow.
2. FlowFile content - Stored in claim files with in the NiFi content_repository. NiFi simple writes the binary contents to a claim and records the starting byte location and number of bytes of the content. This way NiFi does not need to be able to read the content to move it through a dataflow.
It becomes an individual component's code responsibility for knowing how to read the content of a FlowFile. So NiFi includes processor components for many different data types. As far as XML content files, NiFi has limited native options (SplitXML, TransformXML, ValidateXML, XMLReader, and XMLRecordSetWriter). The latter two are controller services that could be used by processors like convertRecord. There is also the possibility that one fo NiFi's scripting processor could be used where the user writes a script that can read an handle the specific content type. There are execute processors that can execute and external command on the server where NiFi is running against the content of a FlowFile. So if there is an external command service that can take content input and return modified content back.
If you found that the provided solution(s) assisted you with your query, please take a moment to login and click Accept as Solution below each response that helped.
Thank you,
Matt
Created 09-26-2022 05:01 AM
Greetings!
Created 09-26-2022 03:36 PM
@ImranAhmed
I am not clear ion what you are trying to do here.
You are looking for some exact string and replacing with nothing?
The search value is a java regex so what little i can see is looking for an exact string match which is being compared against the "entire text". So entire text means entire contents of your FlowFile is being loaded into NiFi's JVM heap also. Why "entire text" instead of "line-by-line"?
Created 09-26-2022 05:05 AM
Dear when i put this xml file then nifi process will replace this text and save xml data into database,before save into database i just want to see data.
Created 09-29-2022 12:05 AM
Dear MattWho,
You are right i just looking exact string and replacing with nothing,because i do not want to save this string in my database,i just want to make sure the data before saving in my database.how can i get output that this data in going to save in my database.
Created 09-30-2022 02:04 PM
@ImranAhmed If I am understanding you correctly, you are trying to verify the content has correctly been modified before it is written out via your invokeHTTP processor.Inspecting that your dataflow is working as expected. If you stop your InvokeHTTP processor after the ReplaceText processor, the FlowFile processed by the ReplaceText will queue in the connection. You can then right click on the connection and list the queue. From there you can view/download the content of that FlowFile post ReplaceText to verify it contains the expected modified content before the InvokeHTTP is started and writes it to your DB.
Thanks,
Matt