/n software Connectors for MuleSoft

Questions / Feedback?

SevenZip Module

Properties   Configuration Settings  

The SevenZip transformer implements a 7zip-compatible Zip compressor and decompressor.

Remarks

The SevenZip module is used when generating BizTalk Pipelines for sending and receiving messages which are desired to be compressed or decompressed.

SevenZip Compressor Module

The SevenZip Compress operation creates an archive based on the specified files. The SevenZip Compressor relies on a Map of filenames to file content as input, e.g. Map<Filename,InputStream>. The elements will be compressed into a Binary SevenZip archive in the output payload.

Compression strength is regulated by the CompressionLevel property. You may also control encryption behavior by setting the Password and EncryptionAlgorithm properties on this module.

Archive Example

In the body of your flow, configure the File List connector to list the contents of the target directory.

Behind the File List connector, transform the output of File List so it can be correctly interpreted by the SevenZip Compressor. The easiest way to do this is with the Set Payload connector. Paste in the following DataWeave code to properly format the File List output so it can be used by the Compressor.

output application/java
---
(0 to sizeOf(payload) - 1) as Array
reduce (index, acc={}) ->
acc ++ { (payload[index].attributes.fileName): payload[index].payload}
Finally, add the SevenZip Compressor. That is all that is required to begin compressing data. Behind the SevenZip Compressor you can write the new archive to disk with a File Write connector or perform further processing.

SevenZip Decompressor Module

The SevenZip Decompress operation extracts the inner files of the input archive. The SevenZip Decompressor relies on a Binary archive in the incoming message payload as input. The elements in the archive will be decompressed into a Map of filenames to decompressed content as key:value pairs in the output payload, e.g. Map<Filename,OutputStream>. The Map elements can be accessed with a For Each scope.

The Password property must be set in order to extract files which have been encrypted. You may also use the ExcludedFiles property to regulate which files are to be extracted from the archive.

Extract Example

First, create an event source such as a Scheduler endpoint to start the flow. Then in the body of your flow, drag an instance of the File Read connector into the project and configure it to read in a particular archive file.

Add an instance of the SevenZip Decompressor behind the File Read connector. There is no need to transform the output data of the File Read connector before passing it to the Decompressor.

Behind the Decompressor add a For Each Scope and set the collection property to payload. This will configure the For Each Scope to iterate over the output of the Decompressor. Then inside the For Each Scope, the filename and decompressed file data are available as key:value pairs.

As an example, to write the file to disk you can use a File Write connector inside the For Each Scope and MuleSoft pluck function. Set the Path property of the File Write connector to:


output application/json 
--- 
"c:/temp/mule/output/" ++ (payload pluck $$)[0]

Set the Content property of the File Write connector to:


output application/java --- ( payload pluck $ )[0]

That is all that is required to configure the File Write connector to write the inner file to disk.

Compressor Property List


The following is the full list of the properties of the compressor module with short descriptions. Click on the links for further details.

CompressionLevelThe compression level to use.
CompressionMethodUsed to set the method of compression.
ExcludedFilesA list of files to exclude.
LogFileThe file to write logging information to at runtime.
LogModeWhat information gets logged during connector execution.
LogTypeHow information gets logged during connector execution.
OtherDefines a set of configuration settings to be used by the transformer.
PasswordA password for the zip archive.
RuntimeLicenseSpecifies the connector runtime license key.
TempPathA temporary directory where uncompressed and compressed data can be stored.

Decompressor Property List


The following is the full list of the properties of the decompressor module with short descriptions. Click on the links for further details.

ExcludedFilesA list of files to exclude.
LogFileThe file to write logging information to at runtime.
LogModeWhat information gets logged during connector execution.
LogTypeHow information gets logged during connector execution.
OtherDefines a set of configuration settings to be used by the transformer.
PasswordA password for the zip archive.
RuntimeLicenseSpecifies the connector runtime license key.
SevenZipAttributesTBD.
TempPathA temporary directory where uncompressed and compressed data can be stored.

Configuration Settings


The following is a list of configuration settings for the module with short descriptions. Click on the links for further details.

 
 
Copyright (c) 2021 /n software inc. - All rights reserved.
/n software Connectors for MuleSoft - Version 20.0 [Build 7722]