-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Implement services (ADR-32) #566
Conversation
00c7672
to
8e4a023
Compare
Think may have to update these: https://github.com/nats-io/nats.py/blob/main/setup.py#L14 |
Thanks for making this -- appears to be working well! I do have a static checker issue with
Adding that to the list of exports in __all__ = [
"api",
"control_subject",
"Verb",
"Endpoint",
"Group",
"Handler",
"Request",
"Service",
"add_service"
] |
I noticed this as well @mgale. It can be resolved by adding a group to a
group.
Not sure if this is expected behavior or if it aligns with go micro API.
Would be cool if you could specify endpoints with dots and they would turn
into groups/subgroups.
Best,
Sam
…On Wed, Jul 3, 2024 at 12:09 AM Michael ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In tests/test_micro.py
<#566 (comment)>:
> + await req.respond(b"42")
+
+ svcs = []
+
+ # Create 5 service responders.
+ for i in range(5):
+ svc = micro.add_service(
+ nc,
+ name="CoolAddService",
+ version="0.1.0",
+ description="Add things together",
+ metadata={"basic": "metadata"},
+ )
+
+ await svc.add_endpoint(
+ name="svc.add",
Running nats cli version 0.1.4:
nats --version
v0.1.4
Returns the following error on nats micro list:
nats: error: /endpoints/0/name: does not match pattern '^[a-zA-Z0-9_-]+$'
The endpoint name can not have a dot "."
—
Reply to this email directly, view it on GitHub
<#566 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANKHY4VBHMQIBVKUCUG5U7DZKN2N7AVCNFSM6AAAAABJBTLE4GVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDCNJVGMZTGNBZGA>
.
You are receiving this because you commented.Message ID: <nats-io/nats.
***@***.***>
|
I noticed an issue with nats-surveyor trying to parse the messages that go through the service, not sure where the failure is or if this works with the nats.go.
From the suryeor code: |
2d71992
to
3dc54ed
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.
LGTM - only a question on some error messages
nats/micro/service.py
Outdated
if self.queue_group: | ||
if not SUBJECT_REGEX.match(self.queue_group): | ||
raise ValueError( | ||
"Invalid queue group. Queue group must not contain spaces, and can only have '>' at the end." |
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.
not sure what >
is at the name of a queue group - this is copy/paste?
if self.subject: | ||
if not SUBJECT_REGEX.match(self.subject): | ||
raise ValueError( | ||
"Invalid subject. Subject must not contain spaces, and can only have '>' at the end." |
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.
is this error for the internal service subjects?
ef0a1cf
to
29428a7
Compare
Co-Authored-By: Guillaume Charbonnier <guillaume.charbonnier@araymond.com>
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.
LGTM
This implements services (ADR-32), this is based on a stripped down version of this implementation by @charbonnierg.
This does not have a "client" or "monitor" type like nats.deno, we can come back and add a higher level interface for it later if it is needed. For the first pass it aims for functional parity with nats.go.
Also adds compatibility tests.
Closes #552