Complete the code to create a NiFi processor that reads data from a file.
processor = ProcessSessionFactory().createSession().get[1]('GetFile')
The processor object is created by calling getProcessor or similar method. Here, processor is the correct attribute to get the processor instance.
Complete the code to set the input directory for the GetFile processor.
processor.setProperty('Input Directory', [1])
The input directory should be a valid path where files are read from. '/data/input' is a typical example.
Fix the error in the code to start the NiFi data flow.
flowController.[1]()To start the NiFi data flow, the start() method must be called on the flow controller.
Fill both blanks to create a processor that routes data based on success or failure.
processor = session.createProcessor('RouteOnAttribute') processor.setProperty('Routing Strategy', [1]) processor.setProperty('Success Relationship', [2])
The routing strategy should be set to 'Route to Property name' to route based on attributes. The success relationship is named 'success'.
Fill all three blanks to create a data flow that reads, transforms, and writes data.
getFile = session.createProcessor('GetFile') getFile.setProperty('Input Directory', [1]) transform = session.createProcessor([2]) putFile = session.createProcessor('PutFile') putFile.setProperty('Output Directory', [3])
The input directory is '/data/input'. The transform processor is 'ReplaceText' to modify data. The output directory is '/data/output'.