CompressContent 2.0.0

Bundle
org.apache.nifi | nifi-standard-nar
Description
Compresses or decompresses the contents of FlowFiles using a user-specified compression algorithm and updates the mime.type attribute as appropriate. A common idiom is to precede CompressContent with IdentifyMimeType and configure Mode='decompress' AND Compression Format='use mime.type attribute'. When used in this manner, the MIME type is automatically detected and the data is decompressed, if necessary. If decompression is unnecessary, the data is passed through to the 'success' relationship. This processor operates in a very memory efficient way so very large objects well beyond the heap size are generally fine to process.
Tags
brotli, bzip2, compress, content, decompress, deflate, gzip, lz4-framed, lzma, snappy, snappy framed, snappy-hadoop, xz-lzma2, zstd
Input Requirement
REQUIRED
Supports Sensitive Dynamic Properties
false
Properties
System Resource Considerations
Resource Description
CPU An instance of this component can cause high usage of this system resource. Multiple instances or high concurrency settings may result a degradation of performance.
MEMORY An instance of this component can cause high usage of this system resource. Multiple instances or high concurrency settings may result a degradation of performance.
Relationships
Name Description
failure FlowFiles will be transferred to the failure relationship if they fail to compress/decompress
success FlowFiles will be transferred to the success relationship after successfully being compressed or decompressed
Reads Attributes
Name Description
mime.type If the Compression Format is set to use mime.type attribute, this attribute is used to determine the compression type. Otherwise, this attribute is ignored.
Writes Attributes
Name Description
mime.type If the Mode property is set to compress, the appropriate MIME Type is set. If the Mode property is set to decompress and the file is successfully decompressed, this attribute is removed, as the MIME Type is no longer known.
Use Cases
  • Compress the contents of a FlowFile
    Description
    Compress the contents of a FlowFile
    Configuration
    "Mode" = "compress"
    "Compression Format" should be set to whichever compression algorithm should be used.
  • Decompress the contents of a FlowFile
    Description
    Decompress the contents of a FlowFile
    Configuration
    "Mode" = "decompress"
    "Compression Format" should be set to whichever compression algorithm was used to compress the data previously.
Use Cases Involving Other Components
  • Check whether or not a FlowFile is compressed and if so, decompress it.
    Description
    Check whether or not a FlowFile is compressed and if so, decompress it.
    Notes
    If IdentifyMimeType determines that the content is not compressed, CompressContent will pass the FlowFile along to the 'success' relationship without attempting to decompress it.
    Keywords
    auto, detect, mime type, compress, decompress, gzip, bzip2
    Processor Configurations
    org.apache.nifi.processors.standard.IdentifyMimeType
    Default property values are sufficient.
    Connect the 'success' relationship to CompressContent.
    
    org.apache.nifi.processors.standard.CompressContent
    "Mode" = "decompress"
    "Compression Format" = "use mime.type attribute"