Interface Triggerable


public interface Triggerable
  • Field Details

  • Method Details

    • onTrigger

      void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) throws ProcessException

      The method called when this processor is triggered to operate by the controller. This method may be called concurrently from different threads. When this method is called depends on how this processor is configured within a controller to be triggered (timing or event based).

      The processor may commit, roll back, or allow the framework to automatically manage the session. If the sessions are to be managed by the framework (recommended) then what it will do depends on several factors. If the method call returns due to an exception then the session will be rolled back. If the method returns normally then the session will be committed or the framework may use the session again for another processor down stream

      Parameters:
      context - in which the component is triggered
      sessionFactory - used to generate ProcessSessions to use for operating on flow files within the repository
      Throws:
      ProcessException - if processing did not complete normally though indicates the problem is an understood potential outcome of processing. The controller/caller will handle these exceptions gracefully such as logging, etc.. If another type of exception is allowed to propagate the controller may no longer trigger this processor to operate as this would indicate a probable coding defect.
    • setMaxConcurrentTasks

      void setMaxConcurrentTasks(int taskCount)
      Determines the number of concurrent tasks that may be running for this Triggerable.
      Parameters:
      taskCount - a number of concurrent tasks this processor may have running
      Throws:
      IllegalArgumentException - if the given value is less than 1
    • getMaxConcurrentTasks

      int getMaxConcurrentTasks()
      Returns:
      the number of tasks that may execute concurrently for this Triggerable.
    • getScheduledState

      ScheduledState getScheduledState()
      Indicates the ScheduledState of this Triggerable. A value of stopped does NOT indicate that the Triggerable has no active threads, only that it is not currently scheduled to be given any more threads. To determine whether or not the Triggerable has any active threads, see
      invalid reference
      ProcessScheduler#getActiveThreadCount(nifi.connectable.Connectable)
      .
      Returns:
      the schedule state
    • isRunning

      boolean isRunning()
      Indicates whether or not this Triggerable is "running". It is considered "running" if it is scheduled to run OR if it is no longer scheduled to be given threads but the remaining threads from the last invocation of onTrigger(ProcessContext, ProcessSessionFactory) have not yet returned
      Returns:
      true if running;false otherwise
    • getSchedulingPeriod

      long getSchedulingPeriod(TimeUnit timeUnit)
      Parameters:
      timeUnit - for the scheduling period of the component
      Returns:
      the amount of time between each scheduling period
    • getSchedulingPeriod

      String getSchedulingPeriod()
      Returns:
      a string representation of the time between each scheduling period
    • setSchedulingPeriod

      void setSchedulingPeriod(String schedulingPeriod)
      Updates how often this Triggerable should be triggered to run
      Parameters:
      schedulingPeriod - to set