# Solace Message Compression

**URL:** <https://community.solace.com/t/solace-message-compression/1124>\
**Category:** Solace Event Broker\
**Created:** [January 25, 2022, 5:21am UTC](https://community.solace.com/t/solace-message-compression/1124 "2022-01-25T05:21:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Monali](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Monali](https://community.solace.com/u/Monali)\
**Post date:** [January 25, 2022, 5:21am UTC](https://community.solace.com/t/solace-message-compression/1124/1 "2022-01-25T05:21:25Z")

</div>

Hi Team,  
I need some help with solace message compression.In our solace broker the maximum message size is configured as 10MB.So I used the below property to compress the message :  
message.setIntProperty(SupportedProperty.SOLACE\_JMS\_COMPRESSION\_LEVEL, 9);  
As of now we don’t have a specific broker to publish compressed message.So is there any way we can compress the message and publish to solace.

---

<div class="post-metadata">

**Author:** ![uherbst](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/uherbst/32/291_2.png) [@uherbst](https://community.solace.com/u/uherbst)\
**Post date:** [January 25, 2022, 5:34am UTC](https://community.solace.com/t/solace-message-compression/1124/2 "2022-01-25T05:34:45Z")

</div>

Hi @Monali,  
Message compression is only about compression during transfer (that is between your client and the broker).  
In the broker itself, the message is always un-compressed - and therefor the uncompressed message size is relevant for maximum message size.  
You can compress your payload on publisher side and un-compress on consumer side, but this is outside the Solace API.

And to answer the question: “Why does the broker handle only uncompressed messages ?”  
Solace broker do protocol translation - and some clients have compressed SMF as protocol, some clients have uncompressed REST or uncompressed MQTT …  
The only way to handle that fast with low latency is to handle only uncompressed messages.

Uli

---

<div class="post-metadata">

**Author:** ![Monali](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Monali](https://community.solace.com/u/Monali)\
**Post date:** [January 25, 2022, 6:29am UTC](https://community.solace.com/t/solace-message-compression/1124/3 "2022-01-25T06:29:08Z")

</div>

Thanks @uherbst for responding so quickly  
“You can compress your payload on publisher side and un-compress on consumer side, but this is outside the Solace API.”  
We are using sol-jms api,may be my question would be very basic but have few queries on the same:  
So I can compress the payload using GZIP and publish the message as BytesMessage.Can we proceed with such approach.

---

<div class="post-metadata">

**Author:** ![uherbst](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/uherbst/32/291_2.png) [@uherbst](https://community.solace.com/u/uherbst)\
**Post date:** [January 25, 2022, 6:31am UTC](https://community.solace.com/t/solace-message-compression/1124/4 "2022-01-25T06:31:19Z")

</div>

yes, that was exactly what I had in my mind.
