Release async-nats/v0.33.0
0.33.0
Overview
This release introduces last planned breaking changes and stabilizes the async API.
Subject in publish methods
The biggest change is how subjects are handled. Until now, publish was of type String
:
client.publish("subject".to_string(), "data".into()).await?;
This was easy to understand and reason about, but had two downsides:
- It was always allocating
- It was cumbersome for codebases working with
&'static str
The signature has been change into:
// Signature
async fn publish(subject: impl ToSubject, payload: Bytes)
// Usage
client.publish("subject", "data".into()).await?;
This is not only more concise, but also allows avoiding allocations when subject is static
,
or when it is Subject
type that can be cheaply cloned leveraging memory optimized bytes::Bytes
mechanism under the hood.
Service API improvements
Beyond that, there were a lot of improvements to Service API to address cross-language compatibility issues.
All structures are now tested against common cross-language json schemas.
Thanks @jadamcrain for all the feedback, issues nad PRs related to Service API!
Docs improvements
Despite every method having documentation with examples, we were aware that sometimes its hard to navigate the docs to find what someone is looking for.
This was addressed by adding module-level docs.
Added
- Add subject type by @caspervonb in #952 & @Jarema in #1147
- Add custom serialized for last_error, update schemas by @piotrpio in #1140
- Add JetStream, kv, object store and service to top level docs examples by @Jarema in #1154
- Add compression option to kv by @Jarema in #1143
- Add TLS first support by @Jarema in #1136
Changed
- Use muxed inbox to handle jetstream publishes by @paolobarbolini in #1130
- Make object store structures more resilient by @Jarema in #1127
Fixed
- Fix service Info to include endpoints info by @Jarema in #1119
- Fix service defaults by @Jarema in #1150
- Fix calculating average processing time as total time / # requests by @jadamcrain in #1152
Misc
- Bump ring crate to v0.17 by @paolobarbolini in #1129
- Cleanup flush logic by @paolobarbolini in #1120
- Improve CI/CD by @nepalez in #1122
- Increase default channel capacity values by @Jarema in #1133
- Remove println by @jadamcrain in #1155
New Contributors
- @jadamcrain made their first contribution in #1152
- @sp-angel made their first contribution in #1128
Full Changelog: async-nats/v0.32.0...async-nats/v0.33.0