Skip to content

Conversation

@snichme
Copy link
Member

@snichme snichme commented Dec 11, 2025

Adds support for the producer to compress the payload by specifying compression algorithm, supported algos are gzip, lz4 and snappy. Looked at adding zstd but didn't find any packages with a synchronous API.

The consumer automatically picks up how the payload is compressed and decompresses it.

Each package is optional and it will be lazy loaded if needed.

Support for gzip, lz4 and snappy
@carlhoerberg
Copy link
Member

I have had as a proud feature of this library that this is a 0 dependency library. Could we make the dependencies optional?

* @param properties - properties to be published
* @param [mandatory] - if the message should be returned if there's no queue to be delivered to
* @param [immediate] - if the message should be returned if it can't be delivered to a consumer immediately (not supported in RabbitMQ)
* @param options - publish options including compression settings
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These methods should map closely to the protocol. Add compression to a high level client.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, we should build out BaseClient to have high level features like auto-reconnect, message coding, rpc client/server etc. Just like the ruby client. This is a WIP in that direction: #180

@baelter
Copy link
Member

baelter commented Dec 11, 2025

Nice! I agree with

These methods should map closely to the protocol. Add compression to a high level client.

IMHO we should build out BaseClient to have high level features like auto-reconnect, message coding, rpc client/server etc. Just like the ruby client. This is a WIP in that direction: #180

@snichme
Copy link
Member Author

snichme commented Dec 12, 2025

I have had as a proud feature of this library that this is a 0 dependency library. Could we make the dependencies optional?

They are, since they are specified as peerDependencies and peerDependenciesMeta->optional=true according to docs and https://medium.com/@ruben.alapont/advanced-npm-working-with-peer-dependencies-b7c43aa852d8 they will not be installed and the user have to install it (by adding the dependecy to their package.json) in order to use a compress.

@snichme
Copy link
Member Author

snichme commented Dec 12, 2025

Nice! I agree with

These methods should map closely to the protocol. Add compression to a high level client.

IMHO we should build out BaseClient to have high level features like auto-reconnect, message coding, rpc client/server etc. Just like the ruby client. This is a WIP in that direction: #180

@baelter sounds good, maybe combine this PR into #180 or at least base this branch on your

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants