How to Compress/Decompress payload in Mule and get back original payload -
i doing sort of poc mule gzip compressor , de-compressor.. mule flow following
<flow name="gzipcompress" doc:name="gzipflow1"> <file:inbound-endpoint path="e:\backup\test" responsetimeout="10000" doc:name="file"> <file:filename-regex-filter pattern="anirban.doc" casesensitive="false"/> </file:inbound-endpoint> <string-to-byte-array-transformer doc:name="string byte array"/> <gzip-compress-transformer/> <file:outbound-endpoint path="e:\backup\test\ss" responsetimeout="10000" doc:name="file"/> </flow> <flow name="gzipuncompress" doc:name="gzipflow2"> <file:inbound-endpoint path="e:\backup\test\ss" responsetimeout="10000" doc:name="file"> <file:filename-regex-filter pattern="anirban.doc" casesensitive="false"/> </file:inbound-endpoint> <gzip-uncompress-transformer /> <byte-array-to-string-transformer /> <file:outbound-endpoint path="e:\backup\test\ss\new folder" responsetimeout="10000" doc:name="file"/> </flow> </mule>
now issue have file anirban.doc around 80.0 kb before compression .. when put file in folder compression, file inbound of gzipcompress flow picks , compress .. after compression file size gets around 20 kb fine .. when try uncompress file using gzipuncompress flow , file in output folder of file outbound endpoint gzipuncompress flow .. , time called uncompress file of size 96.0 kb .. , when try open file binary format .. question how can uncompressed file same original file size , can open , read , not in binary form same original content .. right way compressing , decompressing file/payload ..
if remove string-to-byte-array-transformer
(which useless , counter productive: keep bytes as possible), gzipcompress
works fine: creates valid gzipped file in output dir.
Comments
Post a Comment