Search code examples
apache-nifihortonworks-data-platformhortonworks-dataflow

How to set up default 'Run Schedule' for a processor


I use GenerateFlowFile processor very often to test some other processor's behaviour and to understand the flow. But every time, I forget to change the default 'Run Schedule' which is by default '0'. And before I realize it bombards the flow with thousands of files.

Is there a way, to change the default value? It gets really frustrating sometimes.


Solution

  • There is not a way to do it without changing the code.

    There is an annotation that can be used on a processor for it to indicate default scheduling options:

    @DefaultSchedule(strategy = SchedulingStrategy.TIMER_DRIVEN, period = "1 min")
    

    You would have to get NiFi's source code and add this annotation to GenerateFlowFile and then rebuild the standard NAR and deploy it to your NiFi instance.