nifi中清空 Queue

参考:https://kisstechdocs.wordpress.com/2015/01/15/simple-tasks-in-nifi-clearing-a-queue/

Clearing a Queue

A common question that new users of Apache NiFi (incubating) have is how to clear out a queue of FlowFiles that has built up in a connection. Sometimes your dataflow doesn’t work as you expected, and data starts to build up in a queue. The answer to this question depends on whether you care about the data that is in the queue. If not, see the first scenario below. If so, see the second scenario.

Scenario 1

If you are merely setting up a new dataflow and have “test data” running through it that you don’t care about, then here is a simple solution:

  1. Stop both processors on either side of the connection.
  2. Right-click on the connection and select Configure.
  3. On the Settings tab of the Configure Connection window, change the FlowFile expiration setting from 0 sec to 1 sec.

This will cause all the FlowFiles in the queue to expire and be removed from the dataflow. You may find that you need to restart the processors to see the files clear out of the queue. But often, you just need to right-click on a blank space in the graph and select “Refresh status” to see the queue update.

NOTE: Be sure to change the setting back to 0 sec before running data through your flow again!

Scenario 2

If you do care about the data in the queue and you don’t want to lose it, there is also a way to deal with that scenario. It may or may not provide a solution to what is causing your dataflow to fail, but it will give you a way to move the data elsewhere in any case:

  1. Stop both processors on either side of the connection.
  2. Left-click on the connection so that it is selected.

  1. You will notice that source-side of the connection has a small red box, and the destination side has a small blue box.
  2. You may click and drag the blue box to move that end of the connection to another processor.
  3. Perhaps you will want to try sending the data to a new copy of the processor where the data was building up, but with a different configuration — to see if that solves the problem. Alternatively, you can at least send the data to a PutFile processor to copy the data off into a local error directory. This could allow you to troubleshoot an issue with the data itself before trying to send it back through the flow.

你可能感兴趣的:(nifi中清空 Queue)