The Decompression component is used to decompress the incoming data or file and send it forward. This component can decompress file and store it to target directory. It makes use of the APIs available in the java.util.zip package. The component decompresses the text and the hash table values existing in the incoming document, and then sends the document forward.
Configuration and Testing
Figure 1: Interaction Configurations panel in the CPS
Attributes
Decompress File?
This checkbox has to be enabled for decompressing the input file.
After this property is enabled, below attributes (which appear when Decompress File attribute is selected) need to be specified.
Figure 2: Attributes supporting Decompress file property
Source File Directory
The directory from where the component picks the files to be decompress. Provide absolute path here.
Source File Name
The name of file which need to be decompress. Provide the full file name with extension .zip, for example, inputfile.zip
Target File Directory
The directory to which the component send the compressed file/s. Provide absolute path here.
Action if same file exist
If the file with same name exists in the target folder, choose the action to be taken from the below options:
- Overwrite: Overwrites the existing file and hence the old file gets replaced with the new one.
- Rename: Renames the file with "filename + MMddyyHHmmss + counter(optional)".
Figure 3: Options of Actions in case file name matches
Binary Output Required
Enable this to have the decompressed message as binary instead of text.
Scheduler Configurations
Please refer the respective section in Common Configurations page.
Transport Configurations
Please refer the respective section in Common Configurations page.
Error Handling
Please refer the sections Request Processing Error and Invalid Request Error in the Error Handling section of Common Configurations page for details.
Testing
The configuration can be tested by clicking the Test button in the Interaction Configuration panel.
Sample Input
Message for the compressed file in the Compression component, as below, acts as the input for Decompression component.
Figure 4: Sample Input Message
Output
Output Message tab shows the response when Execute button clicked.
Figure 5: Response Generated
Functional Demonstration
Scenario 1
Decompress the incoming data.
Configure the Decompression adapter and use Feeder, Compression and Display components to create an event process. When we send the input from the Feeder as in the Sample Input below, the compression adapter compresses it and forwards it to the Decompression adapter which in turn decompresses the input and forwards the output to Display adapter.
Binary as well as Text outputs are generated (as shown in the figures below) corresponding to the configuration made in the CPS (enabling and disabling Binary Output Required property respectively) of Decompression adapter.
Figure 6: Sample event process
Sample Input
Provide Sample input as "Hello World" in the Feeder window and click Send.
Figure 7: Sample Input in Feeder window
Binary Output
Below will be the output if Binary Output Required property is enabled.
Figure 8: Output of Decompression adapter in binary format
Below will be the output if Binary Output Required property is disabled.
Figure 9: Output of Decompression adapter in text format
Useful Tip
- If compressed zip file contain more than one file than output of decompression has multiple output message each containing file name and file path .
- When component configuration sends multiple messages, messages contain the following JMS properties which help to identify the first and last messages:
- First document - START_EVENT=true
- All documents - RECORD_INDEX=<index of output message>
- Last document - CLOSE_EVENT=true