Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce http2 #119

Merged
merged 9 commits into from
Aug 7, 2023
Merged

introduce http2 #119

merged 9 commits into from
Aug 7, 2023

Conversation

jimpil
Copy link
Contributor

@jimpil jimpil commented Aug 4, 2023

This PR shows a migration path away from clj-http. Instead, it uses hato, which wraps the java 11 HttpClient (per #118).

What I have done

  • Created http2.clj mirroring, or at least compatible, with http.clj (in its public api, minus the deprecated stuff). In practice, the new api encourages being explicit about what server you're talking to (first argument), and what http-options you want to use (last argument). The globally mutable convenience of connect! still exists, but is backed behind an atom.
  • Switched the http-api-test require to http2 (to make sure the tests pass).
  • Added docker-compose.yml file (lowers the barrier to contributing)

What needs doing (post merge)

  • Add licence details at the top of http2.clj
  • Rename it to http.clj, replacing the old/existing one
  • Fix the require clause in http-api-test

Let me know if you're happy with how the new namespace looks...It's a little bit longer (even though it has less Vars), but reads nicer/feels simpler, and as I said above, encourages being explicit. Finally, it should be faster, and will take advantage of virtual-threads if available.

@michaelklishin
Copy link
Owner

@jimpil this looks good to me. Thank you!

@jimpil
Copy link
Contributor Author

jimpil commented Aug 7, 2023

Cool - do you need anything else from me here?

@michaelklishin
Copy link
Owner

michaelklishin commented Aug 7, 2023

@jimpil resolve the conflicts :) Also, if we are to add a new namespace, I assume we don't have to bump the version to 6.x? Do you agree?

@jimpil
Copy link
Contributor Author

jimpil commented Aug 7, 2023

Conflicts resolved :)
Now, I'm not sure what you mean by if we are to add a new namespace .... The http2 namespace is supposed to replace the (existing) http one, which allows dropping the clj-http dependency.

Now, regarding bumping major version...If you ask me, I think it's worth doing for two reasons:

  1. First of all, strictly speaking, there are breaking changes in http2.clj (dynamic Var(s) became an atom, and deprecated fns were removed). I don't think that will actually affect anyone, but you never know. In addition, the whole philosophy/character of the namespace is somewhat different than before (e.g. you couldn't even do certain things w/o having called connect!).
  2. exception-handler now takes a map of 8 fns maximum (rather than 9). You might say that this is not by any means breaking (extra keys will just be ignored after all), but it is certainly confusing to accept args that do nothing. In any case, this is far less important than the point above.

To summarise...Even you merge my stuff tonight, the thing is not releasable yet. http.clj needs to be deleted, http2.clj renamed (+ license added) & http-api-test require clause fixed. Also, if you happen to have some sort stress-tests or something, now would be the time to run them. Finally, I do recommend a major version bump, but ultimately this is up to you.

[EDIT]: omg, I almost forgot! You pretty much have to bump the major version, because consumers will now need Java11+, which is a pretty big change...

@michaelklishin michaelklishin merged commit e4c9096 into michaelklishin:master Aug 7, 2023
@michaelklishin
Copy link
Owner

I will bump the version to a 6.0 preview and you are welcome to continue this work. Thank you!

@michaelklishin
Copy link
Owner

But first, let's rename the branch to main, as we did with nearly all other RabbitMQ-related projects.

@jimpil
Copy link
Contributor Author

jimpil commented Oct 25, 2023

Hello, I was just wondering what is happening with this work...The PR has been merged, but none of the post-merge actions have been done. Is there a blocker? Do you need help?

@michaelklishin
Copy link
Owner

This has shipped in 5.5.0. Thanks again.

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.

2 participants