-
Notifications
You must be signed in to change notification settings - Fork 231
Add nats-client package #732
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
base: main
Are you sure you want to change the base?
Conversation
381af5b to
781a9bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new NATS client package with significant performance improvements over the existing nats.aio client. The implementation provides core NATS messaging functionality including publish/subscribe, request/reply, queue groups, and message headers through an asyncio-based Python client.
- Introduces a complete NATS client implementation with high-level API
- Adds comprehensive test coverage for all client features and edge cases
- Includes performance benchmarking tools demonstrating 35x improvement for small messages
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| nats-client/src/nats/client/init.py | Main client implementation with connection management, messaging, and reconnection logic |
| nats-client/src/nats/client/subscription.py | Subscription class supporting async iteration and context management |
| nats-client/src/nats/client/protocol/message.py | NATS protocol message parsing with support for MSG, HMSG, and control messages |
| nats-client/src/nats/client/protocol/command.py | Command encoding for NATS protocol operations (PUB, SUB, CONNECT, etc.) |
| nats-client/src/nats/client/message.py | Message data structures including Headers, Status, and Message classes |
| nats-client/tests/ | Comprehensive test suite covering client functionality, subscriptions, and protocol handling |
| nats-client/tools/bench.py | Benchmarking tool for performance testing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
83d0f80 to
44fb982
Compare
781a9bf to
9a8cd71
Compare
|
Move this to be under |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see anything in the SSL context init to handle the server identity for TLS identity verification, when we learnt a reconnect address as an IP from the INFO line?
If we connect with a hostname originally, we validate that hostname in the cert, and if we reconnect to a learnt IP address, we validate that same original hostname as present in the new server cert. Did I just miss the handling of that?
accfd1c to
20963ae
Compare
9a8cd71 to
0094dba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 21 out of 22 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
.github/workflows/test.yml:1
- Git merge conflict markers are present in the CI configuration file. These need to be resolved before merging.
name: test
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 21 out of 22 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
16d8621 to
7acfd1f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the import to nats.experimental.aio.client while iterating on the implementation, then can work using that namespace in the other branches with the JetStream changes.
So Also would make all the currently pending PRs painful to merge and also the ones that aren't opened yet (e.g client auth, client tls, jetstream ordered consumer). Not sure what the benefit is of such a rename? |
7acfd1f to
2e13fe5
Compare
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
c015d99 to
d1ec510
Compare
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
a3fc895 to
71eb800
Compare
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
6eb24dc to
bd8a5f0
Compare
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
Signed-off-by: Casper Beyer <casper@synadia.com>
This adds a standalone nats.client package
Main differences in
nats.clientcompared tonats.aio