Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Support gzip encoding for request and response #301

Merged
merged 14 commits into from
Mar 29, 2022
Merged

Support gzip encoding for request and response #301

merged 14 commits into from
Mar 29, 2022

Conversation

otrosien
Copy link
Member

@otrosien otrosien commented Mar 10, 2022

Adds transparent gzip support for consuming and publishing events from Nakadi.

For gzip-encoding of server responses, the clients are sending Accept-Encoding headers and are transparently handling this within the http-client libraries. For HTTP-POST compression, there is no pre-negotiation within HTTP, so need to rely on Nakadi supporting gzip compression, and pass Content-Encoding header alongside with gzipped POST body. On the respective RequetFactory enabling or disabling content-encoding is a mandatory choice, and this makes setting the RequestFactory a mandatory choice when building the NakadiClient as well.

Closes #297

TODO:

  • README section on compression
  • API Docs
  • Enable transparent gzip support of all supported clients (apache does it, okhttp too)

@otrosien otrosien force-pushed the gzip branch 2 times, most recently from 3364965 to ce065fe Compare March 10, 2022 17:03
@otrosien otrosien marked this pull request as ready for review March 10, 2022 17:11
@otrosien otrosien changed the title Support gzip encoding in fahrschein-http-simple Support gzip encoding for request and response by default Mar 14, 2022
@otrosien otrosien force-pushed the gzip branch 2 times, most recently from 910b80d to 2de7ea9 Compare March 18, 2022 10:43
Support gzip compression for publishing

Add references to spring

documentation, code fix

deletes an unrelated change

revert draining (to avoid mixing of concerns)

Adds API docs to RequestFactory interface
adds readme paragraph on compression
@otrosien otrosien force-pushed the gzip branch 2 times, most recently from d1c0ee0 to 733bccd Compare March 18, 2022 12:21
For requests without body we mustn't set content-encoding headers.
This fixes this bug, caught be end-to-end tests.
* Removed x-flow-id from log4j2.xml
* Explicit imports
* test-scope for fahrschein-e2e-test dependencies
@otrosien otrosien changed the title Support gzip encoding for request and response by default Support gzip encoding for request and response Mar 22, 2022
public class ApacheNakadiClientTest extends AbstractRequestFactoryTest {

@Override
protected RequestFactory getRequestFactory() {
final RequestConfig requestConfig = RequestConfig.custom()
Copy link
Member Author

Choose a reason for hiding this comment

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

I simplified the setup of Spring and Apache request factories for the tests, it's not necessarily giving us any benefit.

@MALPI
Copy link
Collaborator

MALPI commented Mar 24, 2022

👍

1 similar comment
@otrosien
Copy link
Member Author

👍

* Wait for 3minutes for docker-compose to start up. In Github it seems
  to take quite long sometimes
* Don't start nakadi-ui
* Fix the description of automatically enabling compression in README
@otrosien
Copy link
Member Author

👍

1 similar comment
@MALPI
Copy link
Collaborator

MALPI commented Mar 29, 2022

👍

@otrosien otrosien merged commit 0a08629 into master Mar 29, 2022
@otrosien otrosien deleted the gzip branch March 29, 2022 16:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default HTTP client does not support compression
2 participants