@EventDriven @SideEffectFree @SupportsBatching @Tags(value={"json","split","jsonpath"}) @InputRequirement(value=INPUT_REQUIRED) @CapabilityDescription(value="Splits a JSON File into multiple, separate FlowFiles for an array element specified by a JsonPath expression. Each generated FlowFile is comprised of an element of the specified array and transferred to relationship \'split,\' with the original file transferred to the \'original\' relationship. If the specified JsonPath is not found or does not evaluate to an array element, the original file is routed to \'failure\' and no files are generated.") @WritesAttribute(attribute="fragment.identifier",description="All split FlowFiles produced from the same parent FlowFile will have the same randomly generated UUID added for this attribute") @WritesAttribute(attribute="fragment.index",description="A one-up number that indicates the ordering of the split FlowFiles that were created from a single parent FlowFile") @WritesAttribute(attribute="fragment.count",description="The number of split FlowFiles generated from the parent FlowFile") @WritesAttribute(attribute="segment.original.filename ",description="The filename of the parent FlowFile") @SystemResourceConsideration(resource=MEMORY, description="The entirety of the FlowFile\'s content (as a JsonNode object) is read into memory, in addition to all of the generated FlowFiles representing the split JSON. If many splits are generated due to the size of the JSON, or how the JSON is configured to be split, a two-phase approach may be necessary to avoid excessive use of memory.") public class SplitJson extends AbstractJsonPathProcessor
AbstractJsonPathProcessor.JsonPathValidator
Modifier and Type | Field and Description |
---|---|
static PropertyDescriptor |
ARRAY_JSON_PATH_EXPRESSION |
private AtomicReference<com.jayway.jsonpath.JsonPath> |
JSON_PATH_REF |
private String |
nullDefaultValue |
private List<PropertyDescriptor> |
properties |
static Relationship |
REL_FAILURE |
static Relationship |
REL_ORIGINAL |
static Relationship |
REL_SPLIT |
private Set<Relationship> |
relationships |
EMPTY_STRING_OPTION, NULL_REPRESENTATION_MAP, NULL_STRING_OPTION, NULL_VALUE_DEFAULT_REPRESENTATION
Constructor and Description |
---|
SplitJson() |
Modifier and Type | Method and Description |
---|---|
protected Collection<ValidationResult> |
customValidate(ValidationContext validationContext) |
Set<Relationship> |
getRelationships() |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected void |
init(ProcessorInitializationContext context) |
void |
onPropertyModified(PropertyDescriptor descriptor,
String oldValue,
String newValue) |
void |
onScheduled(ProcessContext processContext) |
void |
onTrigger(ProcessContext processContext,
ProcessSession processSession) |
getResultRepresentation, isJsonScalar, validateAndEstablishJsonContext
onTrigger
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue
equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getPropertyDescriptor, getPropertyDescriptors, validate
public static final PropertyDescriptor ARRAY_JSON_PATH_EXPRESSION
public static final Relationship REL_ORIGINAL
public static final Relationship REL_SPLIT
public static final Relationship REL_FAILURE
private List<PropertyDescriptor> properties
private Set<Relationship> relationships
private final AtomicReference<com.jayway.jsonpath.JsonPath> JSON_PATH_REF
private volatile String nullDefaultValue
protected void init(ProcessorInitializationContext context)
init
in class AbstractSessionFactoryProcessor
public Set<Relationship> getRelationships()
getRelationships
in interface Processor
getRelationships
in class AbstractSessionFactoryProcessor
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors
in class AbstractConfigurableComponent
public void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String newValue)
onPropertyModified
in interface ConfigurableComponent
onPropertyModified
in class AbstractConfigurableComponent
protected Collection<ValidationResult> customValidate(ValidationContext validationContext)
customValidate
in class AbstractConfigurableComponent
@OnScheduled public void onScheduled(ProcessContext processContext)
public void onTrigger(ProcessContext processContext, ProcessSession processSession)
onTrigger
in class AbstractProcessor
Copyright © 2021 Apache NiFi Project. All rights reserved.