0
0
Hadoopdata~10 mins

NiFi for data flow automation in Hadoop - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a NiFi processor that reads data from a file.

Hadoop
processor = ProcessSessionFactory().createSession().get[1]('GetFile')
Drag options to blanks, or click blank then click option'
AprocessorConfig
BprocessorNode
CprocessorFactory
Dprocessor
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect attribute names like processorNode or processorConfig.
Confusing factory methods with processor instances.
2fill in blank
medium

Complete the code to set the input directory for the GetFile processor.

Hadoop
processor.setProperty('Input Directory', [1])
Drag options to blanks, or click blank then click option'
A'/data/input'
B'input_dir'
C'/var/logs'
D'output_dir'
Attempts:
3 left
💡 Hint
Common Mistakes
Using output directory as input directory.
Using relative paths instead of absolute paths.
3fill in blank
hard

Fix the error in the code to start the NiFi data flow.

Hadoop
flowController.[1]()
Drag options to blanks, or click blank then click option'
Ainitialize
Bstop
Cstart
Dshutdown
Attempts:
3 left
💡 Hint
Common Mistakes
Calling stop or shutdown instead of start.
Using initialize which does not start the flow.
4fill in blank
hard

Fill both blanks to create a processor that routes data based on success or failure.

Hadoop
processor = session.createProcessor('RouteOnAttribute')
processor.setProperty('Routing Strategy', [1])
processor.setProperty('Success Relationship', [2])
Drag options to blanks, or click blank then click option'
A'Route to Property name'
B'success'
C'failure'
D'Route to Expression Language'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Route to Expression Language' instead of 'Route to Property name'.
Confusing success and failure relationship names.
5fill in blank
hard

Fill all three blanks to create a data flow that reads, transforms, and writes data.

Hadoop
getFile = session.createProcessor('GetFile')
getFile.setProperty('Input Directory', [1])
transform = session.createProcessor([2])
putFile = session.createProcessor('PutFile')
putFile.setProperty('Output Directory', [3])
Drag options to blanks, or click blank then click option'
A'/data/input'
B'UpdateAttribute'
C'/data/output'
D'ReplaceText'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'UpdateAttribute' instead of 'ReplaceText' for transformation.
Mixing up input and output directories.