SlideShare a Scribd company logo
By Anirban Sen Chowdhary
Compressing & decompressing in mule
.
Fortunately we have gzip-compress-transformer and gzip-
uncompress-transformer available in our Mule
So, to compress a payload in our Mule flow, we can use
gzip-compress-transformer as follows :-
As you can see we have used a file inbound to pick a file in our flow,
and then we compress it with gzip-compress-transformer and the
output of the flow will produce a compressed file
Our corresponding Mule flow will be as follows :-
<flow name="GZipCompress" doc:name="GZipCompress">
<file:inbound-endpoint path="E:backuptest"
responseTimeout="10000" doc:name="File">
<file:filename-regex-filter pattern="abc.doc"
caseSensitive="false" />
</file:inbound-endpoint>
<string-to-byte-array-transformer
doc:name="String to Byte Array" />
<logger
message="Payload size before compression : #[Integer.parseInt(payload.size())/1024] KB"
level="INFO" doc:name="Logger" />
<!-- If you send gzip a String then it gets serialized and mess ends up
in the gzip file. To avoid this convert to byte[] first -->
<gzip-compress-transformer />
<logger
message="Payload size after compression : #[Integer.parseInt(payload.size())/1024] KB"
level="INFO" doc:name="Logger" />
<file:outbound-endpoint path="E:backuptestnewfolder"
responseTimeout="10000" doc:name="File" />
</flow>
As you can see in the code it will pick a file called abc.doc from
E:backuptest location , compress it and put the compressed file to
E:backuptestnewfolder
So, let us place a file abc.doc in the source folder as follows :-
You can see the file size is about 83 KB before compression
Let run our application and we can see, the file has been
transferred to location E:backuptestnewfolder
You can also see in the log that the payload size before compression was
83.0 KB and size after compression is 21.9912 KB
We can see our compressed file here in location
E:backuptestnewfolder :-
Now what about decompressing the file back to the original size
???
In case of decompressing a file back to original size ( Size
before the compression) we will be using gzip-uncompress-
transformer as follows:-
As you can see, it will pick up the compressed file abc.doc from
the location E:backuptestnewfolder and put it into a new
location E:backuptestoriginalFileSize
The corresponding our Mule flow will be :-
<flow name="GZipUnCompress" doc:name="GZipUnCompress"
initialState="started">
<file:inbound-endpoint path="E:backuptestnewfolder"
responseTimeout="10000" doc:name="File">
<file:filename-regex-filter pattern="abc.doc"
caseSensitive="false" />
</file:inbound-endpoint>
<gzip-uncompress-transformer />
<byte-array-to-string-transformer
doc:name="Byte Array to String" />
<file:outbound-endpoint path="E:backuptestoriginalFileSize"
responseTimeout="10000" doc:name="File" />
</flow>
Now if we run the flow, we will get the following in our console :-
The file has been decompressed back to it’s original size into the
location E:backuptestoriginalFileSize
Hope you enjoyed the tips of compressing and decompressing using
gzip-compress-transformer/gzip-uncompress-transformer in Mule
Next slide I will bring some more simple yet interesting topic
Compressing & decompressing in mule

More Related Content

PPTX
Encrypting/Decrypting mule
PPTX
Accessing Mule variables in groovy
PPTX
Process file one after another
PPTX
Mulesoft Using Groovy Component
PPTX
Groovy example in mule
PPTX
Simple groovy example in mule
PPTX
Holding a mule flow
PPTX
Groovy with Mule
Encrypting/Decrypting mule
Accessing Mule variables in groovy
Process file one after another
Mulesoft Using Groovy Component
Groovy example in mule
Simple groovy example in mule
Holding a mule flow
Groovy with Mule

What's hot (13)

PPTX
Groovy in Mule
PPTX
Mule esb db_2
PPTX
Input and output flow using http and java component
PPTX
Mule esb db_1
PPTX
Timer Interceptor in Mule part 2
PPTX
Accessing jms in mule using groovy
PPTX
SmpleGroovyexampleinmule
PDF
Introduction to performance tuning perl web applications
PPTX
Caching and invalidating with managed store
PDF
Building Scalable Websites with Perl
PDF
PyGotham 2014 Introduction to Profiling
PDF
Play Framework
PDF
Altitude SF 2017: Debugging Fastly VCL 101
Groovy in Mule
Mule esb db_2
Input and output flow using http and java component
Mule esb db_1
Timer Interceptor in Mule part 2
Accessing jms in mule using groovy
SmpleGroovyexampleinmule
Introduction to performance tuning perl web applications
Caching and invalidating with managed store
Building Scalable Websites with Perl
PyGotham 2014 Introduction to Profiling
Play Framework
Altitude SF 2017: Debugging Fastly VCL 101
Ad

Similar to Compressing & decompressing in mule (20)

PPTX
Compress and decompress
PPTX
Terminal commands ubuntu 2
PPTX
Improving build solutions dependency management with webpack
PDF
Adobe AEM Maintenance - Customer Care Office Hours
PDF
Getting started with gulpjs
PPTX
Groovy with mule
PPTX
Groovy with mule
DOCX
Postgre sql run book
PDF
Open Source Backup Conference 2014: Migration from bacula to bareos, by Danie...
PPT
HadoooIO.ppt
PPTX
Data integration with embulk
PPTX
Advanced Sqoop
PDF
Microservices blue-green-deployment-with-docker
PDF
LFCS Questions and Answers pdf dumps.pdf
PDF
ApacheConNA 2015: What's new in Apache httpd 2.4
PPT
Basic Linux day 6
PPT
Roy foubister (hosting high traffic sites on a tight budget)
PDF
Getting Started with Ansible
PPTX
File upload php
PDF
Fargate 를 이용한 ECS with VPC 1부
Compress and decompress
Terminal commands ubuntu 2
Improving build solutions dependency management with webpack
Adobe AEM Maintenance - Customer Care Office Hours
Getting started with gulpjs
Groovy with mule
Groovy with mule
Postgre sql run book
Open Source Backup Conference 2014: Migration from bacula to bareos, by Danie...
HadoooIO.ppt
Data integration with embulk
Advanced Sqoop
Microservices blue-green-deployment-with-docker
LFCS Questions and Answers pdf dumps.pdf
ApacheConNA 2015: What's new in Apache httpd 2.4
Basic Linux day 6
Roy foubister (hosting high traffic sites on a tight budget)
Getting Started with Ansible
File upload php
Fargate 를 이용한 ECS with VPC 1부
Ad

More from Anirban Sen Chowdhary (20)

PPTX
Change the game with Game changer
PPTX
Ring central desktop app overview
PPTX
Overview in ringcentral digital line
PPTX
Some basics with ring central
PPTX
Ring central and python
PPTX
RingCentral application development overview
PPTX
Cloze connect ringcentral
PPTX
Overview on ring central errors part 4
PPTX
Setting up your ring central sandbox in steps
PPTX
Overview on ring central errors: part 2
PPTX
Overview on ring central errors
PPTX
Call recording overview ring central
PPTX
Ring central engaging with amazon alexa
PPTX
How ring central sdk changing the game
PPTX
When ring central connect salesforce
PPTX
Mule 4 connecting ring central
PPTX
Ring central sdk
PPTX
Ring central with okta
PPTX
Ring central connecting salesforce overview
PPTX
Ring central call logs overview (part 2)
Change the game with Game changer
Ring central desktop app overview
Overview in ringcentral digital line
Some basics with ring central
Ring central and python
RingCentral application development overview
Cloze connect ringcentral
Overview on ring central errors part 4
Setting up your ring central sandbox in steps
Overview on ring central errors: part 2
Overview on ring central errors
Call recording overview ring central
Ring central engaging with amazon alexa
How ring central sdk changing the game
When ring central connect salesforce
Mule 4 connecting ring central
Ring central sdk
Ring central with okta
Ring central connecting salesforce overview
Ring central call logs overview (part 2)

Recently uploaded (20)

PPT
Teaching material agriculture food technology
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Spectroscopy.pptx food analysis technology
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Encapsulation theory and applications.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Empathic Computing: Creating Shared Understanding
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Teaching material agriculture food technology
Digital-Transformation-Roadmap-for-Companies.pptx
Review of recent advances in non-invasive hemoglobin estimation
sap open course for s4hana steps from ECC to s4
Mobile App Security Testing_ A Comprehensive Guide.pdf
The AUB Centre for AI in Media Proposal.docx
Spectroscopy.pptx food analysis technology
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
20250228 LYD VKU AI Blended-Learning.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Encapsulation theory and applications.pdf
Encapsulation_ Review paper, used for researhc scholars
Empathic Computing: Creating Shared Understanding
NewMind AI Weekly Chronicles - August'25 Week I
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Reach Out and Touch Someone: Haptics and Empathic Computing
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy

Compressing & decompressing in mule

  • 1. By Anirban Sen Chowdhary
  • 3. .
  • 4. Fortunately we have gzip-compress-transformer and gzip- uncompress-transformer available in our Mule
  • 5. So, to compress a payload in our Mule flow, we can use gzip-compress-transformer as follows :- As you can see we have used a file inbound to pick a file in our flow, and then we compress it with gzip-compress-transformer and the output of the flow will produce a compressed file
  • 6. Our corresponding Mule flow will be as follows :- <flow name="GZipCompress" doc:name="GZipCompress"> <file:inbound-endpoint path="E:backuptest" responseTimeout="10000" doc:name="File"> <file:filename-regex-filter pattern="abc.doc" caseSensitive="false" /> </file:inbound-endpoint> <string-to-byte-array-transformer doc:name="String to Byte Array" /> <logger message="Payload size before compression : #[Integer.parseInt(payload.size())/1024] KB" level="INFO" doc:name="Logger" /> <!-- If you send gzip a String then it gets serialized and mess ends up in the gzip file. To avoid this convert to byte[] first --> <gzip-compress-transformer /> <logger message="Payload size after compression : #[Integer.parseInt(payload.size())/1024] KB" level="INFO" doc:name="Logger" /> <file:outbound-endpoint path="E:backuptestnewfolder" responseTimeout="10000" doc:name="File" /> </flow>
  • 7. As you can see in the code it will pick a file called abc.doc from E:backuptest location , compress it and put the compressed file to E:backuptestnewfolder So, let us place a file abc.doc in the source folder as follows :- You can see the file size is about 83 KB before compression
  • 8. Let run our application and we can see, the file has been transferred to location E:backuptestnewfolder You can also see in the log that the payload size before compression was 83.0 KB and size after compression is 21.9912 KB
  • 9. We can see our compressed file here in location E:backuptestnewfolder :-
  • 10. Now what about decompressing the file back to the original size ???
  • 11. In case of decompressing a file back to original size ( Size before the compression) we will be using gzip-uncompress- transformer as follows:- As you can see, it will pick up the compressed file abc.doc from the location E:backuptestnewfolder and put it into a new location E:backuptestoriginalFileSize
  • 12. The corresponding our Mule flow will be :- <flow name="GZipUnCompress" doc:name="GZipUnCompress" initialState="started"> <file:inbound-endpoint path="E:backuptestnewfolder" responseTimeout="10000" doc:name="File"> <file:filename-regex-filter pattern="abc.doc" caseSensitive="false" /> </file:inbound-endpoint> <gzip-uncompress-transformer /> <byte-array-to-string-transformer doc:name="Byte Array to String" /> <file:outbound-endpoint path="E:backuptestoriginalFileSize" responseTimeout="10000" doc:name="File" /> </flow>
  • 13. Now if we run the flow, we will get the following in our console :- The file has been decompressed back to it’s original size into the location E:backuptestoriginalFileSize
  • 14. Hope you enjoyed the tips of compressing and decompressing using gzip-compress-transformer/gzip-uncompress-transformer in Mule Next slide I will bring some more simple yet interesting topic