Class DistributeLoad

java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.standard.DistributeLoad
All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent, org.apache.nifi.processor.Processor

@SideEffectFree @SupportsBatching(defaultDuration=TWENTY_FIVE_MILLIS) @InputRequirement(INPUT_REQUIRED) @TriggerWhenAnyDestinationAvailable @Tags({"distribute","load balance","route","round robin","weighted"}) @CapabilityDescription("Distributes FlowFiles to downstream processors based on a Distribution Strategy. If using the Round Robin strategy, the default is to assign each destination a weighting of 1 (evenly distributed). However, optional properties can be added to the change this; adding a property with the name \'5\' and value \'10\' means that the relationship with name \'5\' will be receive 10 FlowFiles in each iteration instead of 1.") @DynamicProperty(name="The relationship name (positive number)", value="The relationship Weight (positive number)", description="Adding a property with the name \'5\' and value \'10\' means that the relationship with name \'5\' will receive 10 FlowFiles in each iteration instead of 1.") @DynamicRelationship(name="A number 1..<Number Of Relationships>", description="FlowFiles are sent to this relationship per the <Distribution Strategy>") @WritesAttributes(@WritesAttribute(attribute="distribute.load.relationship",description="The name of the specific relationship the FlowFile has been routed through")) public class DistributeLoad extends org.apache.nifi.processor.AbstractProcessor
  • Field Details

    • ROUND_ROBIN

      public static final String ROUND_ROBIN
      See Also:
    • NEXT_AVAILABLE

      public static final String NEXT_AVAILABLE
      See Also:
    • OVERFLOW

      public static final String OVERFLOW
      See Also:
    • STRATEGY_ROUND_ROBIN

      public static final org.apache.nifi.components.AllowableValue STRATEGY_ROUND_ROBIN
    • STRATEGY_NEXT_AVAILABLE

      public static final org.apache.nifi.components.AllowableValue STRATEGY_NEXT_AVAILABLE
    • STRATEGY_OVERFLOW

      public static final org.apache.nifi.components.AllowableValue STRATEGY_OVERFLOW
    • NUM_RELATIONSHIPS

      public static final org.apache.nifi.components.PropertyDescriptor NUM_RELATIONSHIPS
    • DISTRIBUTION_STRATEGY

      public static final org.apache.nifi.components.PropertyDescriptor DISTRIBUTION_STRATEGY
    • properties

      private List<org.apache.nifi.components.PropertyDescriptor> properties
    • RELATIONSHIP_ATTRIBUTE

      public static final String RELATIONSHIP_ATTRIBUTE
      See Also:
    • relationshipsRef

      private final AtomicReference<Set<org.apache.nifi.processor.Relationship>> relationshipsRef
    • strategyRef

    • weightedRelationshipListRef

      private final AtomicReference<List<org.apache.nifi.processor.Relationship>> weightedRelationshipListRef
    • doSetProps

      private final AtomicBoolean doSetProps
  • Constructor Details

    • DistributeLoad

      public DistributeLoad()
  • Method Details

    • init

      protected void init(org.apache.nifi.processor.ProcessorInitializationContext context)
      Overrides:
      init in class org.apache.nifi.processor.AbstractSessionFactoryProcessor
    • createRelationship

      private static org.apache.nifi.processor.Relationship createRelationship(int num)
    • getRelationships

      public Set<org.apache.nifi.processor.Relationship> getRelationships()
      Specified by:
      getRelationships in interface org.apache.nifi.processor.Processor
      Overrides:
      getRelationships in class org.apache.nifi.processor.AbstractSessionFactoryProcessor
    • onPropertyModified

      public void onPropertyModified(org.apache.nifi.components.PropertyDescriptor descriptor, String oldValue, String newValue)
      Specified by:
      onPropertyModified in interface org.apache.nifi.components.ConfigurableComponent
      Overrides:
      onPropertyModified in class org.apache.nifi.components.AbstractConfigurableComponent
    • getSupportedPropertyDescriptors

      protected List<org.apache.nifi.components.PropertyDescriptor> getSupportedPropertyDescriptors()
      Overrides:
      getSupportedPropertyDescriptors in class org.apache.nifi.components.AbstractConfigurableComponent
    • getSupportedDynamicPropertyDescriptor

      protected org.apache.nifi.components.PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
      Overrides:
      getSupportedDynamicPropertyDescriptor in class org.apache.nifi.components.AbstractConfigurableComponent
    • createWeightedList

      @OnScheduled public void createWeightedList(org.apache.nifi.processor.ProcessContext context)
    • updateWeightedRelationships

      private void updateWeightedRelationships(Map<Integer,Integer> weightings)
    • onTrigger

      public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session)
      Specified by:
      onTrigger in class org.apache.nifi.processor.AbstractProcessor