From 561a78b1da6df3c5b4ea7ace98373ae733929873 Mon Sep 17 00:00:00 2001 From: mizosoft Date: Fri, 27 Dec 2024 14:40:31 +0200 Subject: [PATCH] Release 1.8.0 --- CHANGELOG.md | 50 +++++++++++++++++++++++++++++++++ LICENSE | 2 +- README.md | 10 +++---- methanol-brotli/README.md | 4 +-- methanol-gson/README.md | 4 +-- methanol-jackson-flux/README.md | 6 ++-- methanol-jackson/README.md | 6 ++-- methanol-jaxb-jakarta/README.md | 6 ++-- methanol-jaxb/README.md | 6 ++-- methanol-kotlin/README.md | 2 -- methanol-moshi/README.md | 4 +-- methanol-protobuf/README.md | 6 ++-- 12 files changed, 76 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a71db24e3..246b2517a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,55 @@ # Change Log +## Version 1.8.0 + +Ok, here we go. That took a while, but I'm glad I could make it. + +There's been a number of unreleased features brewing in the last two and a half years (!). Guess I could say I've been cooking some Meth—anol, and now it's ready to serve. What's—my—name? Please don't say [Heisenbug](https://en.wikipedia.org/wiki/Heisenbug#:~:text=In%20computer%20programming%20jargon%2C%20a,one%20attempts%20to%20study%20it.). + +Anyhow, here's what's new: + +* Added a [Redis storage backend](https://mizosoft.github.io/methanol/redis/) for the HTTP cache, which supports Standalone & Cluster setups. +* Added the ability to chain caches with different storage backends, expectedly in the order of decreasing locality. + This will work well with the Redis cache. Consider the case where you have multiple instances of your service all sharing + a Redis setup, you can have a chain of (JVM memory -> Redis) or even (JVM memory -> disk -> Redis) caches, so each node can have a local cache to consult first, and the shared Redis cache after. +* The object mapping mechanism has been reworked to stay away from `ServiceLoader` & static state. + We now have an `AdapterCodec` that is registered per-client. + ```java + var mapper = new JsonMapper(); + var adapterCodec = + AdapterCodec.newBuilder() + .encoder(JacksonAdapterFactory.createJsonEncoder(mapper)) + .decoder(JacksonAdapterFactory.createJsonDecoder(mapper)) + .build(); + var client = + Methanol.newBuilder() + .adapterCodec(adapterCodec) + .build(); + + record Person(String name) {} + + HttpResponse response = client.send( + MutableRequest.GET(".../echo", new Person("Jack Reacher"), MediaType.APPLICATION_JSON), + Person.class); + ``` +* Added hip Kotlin extensions. These were enjoyable to work on. [Check them out!](https://mizosoft.github.io/methanol/kotlin/). +* Added adapters for [Moshi](https://github.com/square/moshi). This is mainly intended for Kotlin. +* Added hints API for adapters. This allows carrying arbitrary parameters to customize encoders & decoders. Currently, supported + adapters expose no customization. If you think there's a useful, generalizable customization that can be passed to any of the supported adapters, feel free to create an issue. +* Added `MoreBodyPublishers::ofOutputStream` & `MoreBodyPublishers::ofByteChannel` to be used in favor of `WritableBodyPublisher`. +* Added adapters for [basic](https://mizosoft.github.io/methanol/api/latest/methanol/com/github/mizosoft/methanol/AdapterCodec.Builder.html#basic()) types in the core module. +* Added the ability to conditionally handle responses with [`ResponsePayload`](https://mizosoft.github.io/methanol/api/latest/methanol/com/github/mizosoft/methanol/ResponsePayload.html) using the basic adapter. +* Disk cache writes became considerably faster by avoiding `fsync` on entry writes/updates, which was used to provide durability in a manner that later turned out + to be unnecessary for caches. Now CRC checks are used. Reads however became slightly slower. +* Added adapters for JAXB Jakarta. They're practically the same as JAXB JavaEE, but use the newer namespaces. +* New `HttpClient` APIs for closure & for setting a local socket address have been implemented. +* As of Java 16, `sendAsync(...).cancel(true)`, or an interruption for the thread calling `send` can cancel the underlying + exchange. This is made sure to continue being the case even after the Methanol seasoning. + +There are other incremental improvements here and there that I may have missed. I promise though your code won't break after the update. If that happens, please file an issue. + +Later! + ## Version 1.7.0 *9-5-2022* diff --git a/LICENSE b/LICENSE index 0ac3b657c..e3f819bf7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2024 mizosoft +Copyright (c) 2024 Moataz Hussein Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index f4de52022..8ebda086e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -*note: documentation may contain updates for 1.8.0, which is not yet released* - # Methanol [![CI status](https://img.shields.io/github/actions/workflow/status/mizosoft/methanol/build.yml?branch=master&logo=github&style=flat-square)](https://github.com/mizosoft/methanol/actions) @@ -14,14 +12,14 @@ You can say it's an `HttpClient` wrapper, but you'll see it almost seamlessly in Methanol isn't invasive. The core library has zero runtime dependencies. However, special attention is given to object mapping, so integration with libraries like Jackson or Gson becomes a breeze. -[//]: # (There's also a nice DSL for Kotlin lovers!) +There's also a Kotlin DSL! ## Installation ### Gradle -```gradle -implementation 'com.github.mizosoft.methanol:methanol:1.7.0' +```kotlin +implementation("com.github.mizosoft.methanol:methanol:1.8.0") ``` ### Maven @@ -31,7 +29,7 @@ implementation 'com.github.mizosoft.methanol:methanol:1.7.0' com.github.mizosoft.methanol methanol - 1.7.0 + 1.8.0 ``` diff --git a/methanol-brotli/README.md b/methanol-brotli/README.md index 41d7bdcd5..a246ddc94 100644 --- a/methanol-brotli/README.md +++ b/methanol-brotli/README.md @@ -7,7 +7,7 @@ Provides [brotli][brotli] decompression. ### Gradle ```gradle -implementation 'com.github.mizosoft.methanol:methanol-brotli:1.7.0' +implementation("com.github.mizosoft.methanol:methanol-brotli:1.8.0") ``` ### Maven @@ -16,7 +16,7 @@ implementation 'com.github.mizosoft.methanol:methanol-brotli:1.7.0' com.github.mizosoft.methanol methanol-brotli - 1.7.0 + 1.8.0 ``` diff --git a/methanol-gson/README.md b/methanol-gson/README.md index d388fd675..6978584c7 100644 --- a/methanol-gson/README.md +++ b/methanol-gson/README.md @@ -7,7 +7,7 @@ Adapters for JSON using [Gson][gson]. ### Gradle ```kotlin -implementation("com.github.mizosoft.methanol:methanol-gson:1.7.0") +implementation("com.github.mizosoft.methanol:methanol-gson:1.8.0") ``` ### Maven @@ -16,7 +16,7 @@ implementation("com.github.mizosoft.methanol:methanol-gson:1.7.0") com.github.mizosoft.methanol methanol-gson - 1.7.0 + 1.8.0 ``` diff --git a/methanol-jackson-flux/README.md b/methanol-jackson-flux/README.md index a02c64675..f1123c3a4 100644 --- a/methanol-jackson-flux/README.md +++ b/methanol-jackson-flux/README.md @@ -22,8 +22,8 @@ With the exception of `Mono`, any subtype of `org.reactivestreams.Publisher` or ### Gradle -```gradle -implementation("com.github.mizosoft.methanol:methanol-jackson-flux:1.7.0") +```kotlin +implementation("com.github.mizosoft.methanol:methanol-jackson-flux:1.8.0") ``` ### Maven @@ -32,7 +32,7 @@ implementation("com.github.mizosoft.methanol:methanol-jackson-flux:1.7.0") com.github.mizosoft.methanol methanol-jackson-flux - 1.7.0 + 1.8.0 ``` diff --git a/methanol-jackson/README.md b/methanol-jackson/README.md index 6a9fa373a..a9b3d9035 100644 --- a/methanol-jackson/README.md +++ b/methanol-jackson/README.md @@ -6,8 +6,8 @@ Adapters for [Jackson][jackson]. ### Gradle -```gradle -implementation("com.github.mizosoft.methanol:methanol-jackson:1.7.0") +```kotlin +implementation("com.github.mizosoft.methanol:methanol-jackson:1.8.0") ``` ### Maven @@ -16,7 +16,7 @@ implementation("com.github.mizosoft.methanol:methanol-jackson:1.7.0") com.github.mizosoft.methanol methanol-jackson - 1.7.0 + 1.8.0 ``` diff --git a/methanol-jaxb-jakarta/README.md b/methanol-jaxb-jakarta/README.md index 8f13510bf..76f52d4f1 100644 --- a/methanol-jaxb-jakarta/README.md +++ b/methanol-jaxb-jakarta/README.md @@ -6,8 +6,8 @@ Adapters for XML using Jakarta EE's [JAXB][jaxb]. ### Gradle -```gradle -implementation("com.github.mizosoft.methanol:methanol-jaxb-jakarta:1.7.0") +```kotlin +implementation("com.github.mizosoft.methanol:methanol-jaxb-jakarta:1.8.0") ``` ### Maven @@ -16,7 +16,7 @@ implementation("com.github.mizosoft.methanol:methanol-jaxb-jakarta:1.7.0") com.github.mizosoft.methanol methanol-jaxb-jakarta - 1.7.0 + 1.8.0 ``` diff --git a/methanol-jaxb/README.md b/methanol-jaxb/README.md index 62bc3c2dd..1b86fb4b4 100644 --- a/methanol-jaxb/README.md +++ b/methanol-jaxb/README.md @@ -6,8 +6,8 @@ Adapters for XML using Java EE's [JAXB][jaxb]. ### Gradle -```gradle -implementation("com.github.mizosoft.methanol:methanol-jaxb:1.7.0") +```kotlin +implementation("com.github.mizosoft.methanol:methanol-jaxb:1.8.0") ``` ### Maven @@ -16,7 +16,7 @@ implementation("com.github.mizosoft.methanol:methanol-jaxb:1.7.0") com.github.mizosoft.methanol methanol-jaxb - 1.7.0 + 1.8.0 ``` diff --git a/methanol-kotlin/README.md b/methanol-kotlin/README.md index bee2ac164..9772ae5c1 100644 --- a/methanol-kotlin/README.md +++ b/methanol-kotlin/README.md @@ -1,7 +1,5 @@ # methanol-kotlin -*note: coming soon!* - Kotlin extensions for Methanol, which include: - A DSL for HTTP requests. diff --git a/methanol-moshi/README.md b/methanol-moshi/README.md index a11c79759..09eeab717 100644 --- a/methanol-moshi/README.md +++ b/methanol-moshi/README.md @@ -7,7 +7,7 @@ Adapters for JSON using [moshi](https://github.com/square/moshi). ### Gradle ```gradle -implementation("com.github.mizosoft.methanol:methanol-moshi:1.7.0") +implementation("com.github.mizosoft.methanol:methanol-moshi:1.8.0") ``` ### Maven @@ -16,7 +16,7 @@ implementation("com.github.mizosoft.methanol:methanol-moshi:1.7.0") com.github.mizosoft.methanol methanol-moshi - 1.7.0 + 1.8.0 ``` diff --git a/methanol-protobuf/README.md b/methanol-protobuf/README.md index 4f6f68a79..2f51be5eb 100644 --- a/methanol-protobuf/README.md +++ b/methanol-protobuf/README.md @@ -11,8 +11,8 @@ Any subtype of `MessageLite` is supported by encoders & decoders. Decoders can o ### Gradle -```gradle -implementation("com.github.mizosoft.methanol:methanol-protobuf:1.7.0") +```kotlin +implementation("com.github.mizosoft.methanol:methanol-protobuf:1.8.0") ``` ### Maven @@ -21,7 +21,7 @@ implementation("com.github.mizosoft.methanol:methanol-protobuf:1.7.0") com.github.mizosoft.methanol methanol-protobuf - 1.7.0 + 1.8.0 ```