-
Notifications
You must be signed in to change notification settings - Fork 138
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
Microservice support #640
Microservice support #640
Conversation
Welcome to the NATS C client repo ;-) I understand that this is still a WIP, but since it will be a new addition likely part of a v3.7.0 release, I would recommend that you locally pull the updated I may do a |
a626cfd
to
1961a5f
Compare
@kozlovic I am getting close to having most of the implementation in place. I can really use maybe not yet a thorough review, but a large-scale assessment of the approaches used, and a scan for obvious snafus. Personally, I feel most controversial about |
fd10c2c
to
659afcb
Compare
659afcb
to
8e27ede
Compare
f316703
to
150def9
Compare
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
Fixed microservice cleanup and tests
@kozlovic apologies for not squashing all these commits, I now set "squash-merge" as the default for PRs to avoid it going forward. Please take a final look at this PR; there is #663 still outstanding but it's just a change in INFO/JSON, passes the tests, I think a cursory look will suffice or just leave it to @piotrpio since he knows the context. I'd appreciate another Windows compile (on the ^^ branch?) since I still have not been able to set up a functional windows worker build. |
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.
The test test_MicroAsyncErrorHandler
is causing an assert failure on Windows and I have not yet been able to figure out what the issue is. Will continue looking into that when I have some time.
* More verbose endpoint INFO * better clone/free for metadata * (valgrind) free test JSON array
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. Let's merge this and I will get back to the Windows specific issue as a separate PR. Thanks!
@levb Could you please not merge yet? I am going to push a commit that fixes the issues that I found on Windows. Thanks! |
The change that I asked to make earlier regarding nats_vsnprint in some places was wrong, but more importantly, you can't pass a NULL buffer on Windows in order to calculate the length of the formatted string. Instead, I added a new macro that uses a different function for Windows. Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
@levb Ok, please review the latest commit I pushed and if it is ok with you, then feel free to merge since I already gave the LGTM for the rest. |
Description
This PR adds NATS microservice support. See ./examples/micro-hello.c for a very simple NATS microservice implementation.
Contains:
$SVC.PING
,$SVC.INFO
,$SVC.STATS
, etc.)micro-hello
is a simple examplemicro-sequence
,micro-func
, andmicro-arithmetics
are a multi-service example that calculates sum(1/func(N)).micro-stats
sets a custom stats handler and keeps state in the microservice.microError
- microservice-level errors, with aErrorf
andWrapf
functions.nats_marshalDuration
- formats durations, go-stylemicroArgs
a simple space-deparated args parser, for examples, 2/5 prefer to publically exposenats_JSON
?