Class SplitJson

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

@SideEffectFree @SupportsBatching @Tags({"json","split","jsonpath"}) @InputRequirement(INPUT_REQUIRED) @CapabilityDescription("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
  • Field Details

    • ARRAY_JSON_PATH_EXPRESSION

      public static final org.apache.nifi.components.PropertyDescriptor ARRAY_JSON_PATH_EXPRESSION
    • PROPERTY_DESCRIPTORS

      private static final List<org.apache.nifi.components.PropertyDescriptor> PROPERTY_DESCRIPTORS
    • REL_ORIGINAL

      public static final org.apache.nifi.processor.Relationship REL_ORIGINAL
    • REL_SPLIT

      public static final org.apache.nifi.processor.Relationship REL_SPLIT
    • REL_FAILURE

      public static final org.apache.nifi.processor.Relationship REL_FAILURE
    • RELATIONSHIPS

      private static final Set<org.apache.nifi.processor.Relationship> RELATIONSHIPS
    • JSON_PATH_REF

      private final AtomicReference<com.jayway.jsonpath.JsonPath> JSON_PATH_REF
    • nullDefaultValue

      private volatile String nullDefaultValue
    • jsonPathConfiguration

      private volatile com.jayway.jsonpath.Configuration jsonPathConfiguration
  • Constructor Details

    • SplitJson

      public SplitJson()
  • Method Details

    • 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
    • getSupportedPropertyDescriptors

      protected List<org.apache.nifi.components.PropertyDescriptor> getSupportedPropertyDescriptors()
      Overrides:
      getSupportedPropertyDescriptors in class org.apache.nifi.components.AbstractConfigurableComponent
    • 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
    • customValidate

      protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext)
      Overrides:
      customValidate in class org.apache.nifi.components.AbstractConfigurableComponent
    • onScheduled

      @OnScheduled public void onScheduled(org.apache.nifi.processor.ProcessContext processContext)
    • onTrigger

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