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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static interfaceImplementations must be thread-safe.private static classprivate classprivate classprivate class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.nifi.components.PropertyDescriptorprivate final AtomicBooleanstatic final Stringstatic final org.apache.nifi.components.PropertyDescriptorstatic final Stringprivate List<org.apache.nifi.components.PropertyDescriptor> static final Stringprivate final AtomicReference<Set<org.apache.nifi.processor.Relationship>> static final Stringstatic final org.apache.nifi.components.AllowableValuestatic final org.apache.nifi.components.AllowableValuestatic final org.apache.nifi.components.AllowableValueprivate final AtomicReference<DistributeLoad.DistributionStrategy> private final AtomicReference<List<org.apache.nifi.processor.Relationship>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static org.apache.nifi.processor.RelationshipcreateRelationship(int num) voidcreateWeightedList(org.apache.nifi.processor.ProcessContext context) Set<org.apache.nifi.processor.Relationship> protected org.apache.nifi.components.PropertyDescriptorgetSupportedDynamicPropertyDescriptor(String propertyDescriptorName) protected List<org.apache.nifi.components.PropertyDescriptor> protected voidinit(org.apache.nifi.processor.ProcessorInitializationContext context) voidonPropertyModified(org.apache.nifi.components.PropertyDescriptor descriptor, String oldValue, String newValue) voidonTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) private voidupdateWeightedRelationships(Map<Integer, Integer> weightings) Methods inherited from class org.apache.nifi.processor.AbstractProcessor
onTriggerMethods inherited from class org.apache.nifi.processor.AbstractSessionFactoryProcessor
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueMethods inherited from class org.apache.nifi.components.AbstractConfigurableComponent
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.nifi.components.ConfigurableComponent
getPropertyDescriptor, getPropertyDescriptors, validateMethods inherited from interface org.apache.nifi.processor.Processor
isStateful, migrateProperties, migrateRelationships
-
Field Details
-
ROUND_ROBIN
- See Also:
-
NEXT_AVAILABLE
- See Also:
-
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
-
RELATIONSHIP_ATTRIBUTE
- See Also:
-
relationshipsRef
-
strategyRef
-
weightedRelationshipListRef
private final AtomicReference<List<org.apache.nifi.processor.Relationship>> weightedRelationshipListRef -
doSetProps
-
-
Constructor Details
-
DistributeLoad
public DistributeLoad()
-
-
Method Details
-
init
protected void init(org.apache.nifi.processor.ProcessorInitializationContext context) - Overrides:
initin classorg.apache.nifi.processor.AbstractSessionFactoryProcessor
-
createRelationship
private static org.apache.nifi.processor.Relationship createRelationship(int num) -
getRelationships
- Specified by:
getRelationshipsin interfaceorg.apache.nifi.processor.Processor- Overrides:
getRelationshipsin classorg.apache.nifi.processor.AbstractSessionFactoryProcessor
-
onPropertyModified
public void onPropertyModified(org.apache.nifi.components.PropertyDescriptor descriptor, String oldValue, String newValue) - Specified by:
onPropertyModifiedin interfaceorg.apache.nifi.components.ConfigurableComponent- Overrides:
onPropertyModifiedin classorg.apache.nifi.components.AbstractConfigurableComponent
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classorg.apache.nifi.components.AbstractConfigurableComponent
-
getSupportedDynamicPropertyDescriptor
protected org.apache.nifi.components.PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) - Overrides:
getSupportedDynamicPropertyDescriptorin classorg.apache.nifi.components.AbstractConfigurableComponent
-
createWeightedList
@OnScheduled public void createWeightedList(org.apache.nifi.processor.ProcessContext context) -
updateWeightedRelationships
-
onTrigger
public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) - Specified by:
onTriggerin classorg.apache.nifi.processor.AbstractProcessor
-