Skip to content
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

Add overload for empty requests #502

Merged
merged 2 commits into from
May 29, 2024
Merged

Add overload for empty requests #502

merged 2 commits into from
May 29, 2024

Conversation

mtmk
Copy link
Collaborator

@mtmk mtmk commented May 29, 2024

Proposing a convenience method where request payload isn't required in request-reply calls. It is fairly common to request data without sending any payload. With this method application code can avoid boilerplate null data parameter and request type parameter making the call much more succinct.

// current way of sending an empty request payload
var reply1 = await nats.RequestAsync<object, int>(subject, data: null);

// proposed API. calls the method above
var reply2 = await nats.RequestAsync<int>(subject);

mtmk added 2 commits May 29, 2024 17:59
Convenience method where request payload isn't required.
@mtmk mtmk requested a review from caleblloyd May 29, 2024 17:08
Copy link
Collaborator

@caleblloyd caleblloyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems valuable! LGTM

@mtmk mtmk merged commit 177112b into main May 29, 2024
10 checks passed
@mtmk mtmk deleted the request-empty-reply branch May 29, 2024 17:57
@mtmk mtmk changed the title [PROPOSAL] Add overload for empty requests Add overload for empty requests May 29, 2024
mtmk added a commit that referenced this pull request Jun 11, 2024
* Add ResumeAtRevision support to KV Watcher (#491)
* prefer sub channel ReadAllAsync and rm SubAnchor (#507)
* Keep sub alive when reading channel (#506)
* Add overload for empty requests (#502)
@mtmk mtmk mentioned this pull request Jun 11, 2024
mtmk added a commit that referenced this pull request Jun 11, 2024
* Add ResumeAtRevision support to KV Watcher (#491)
* prefer sub channel ReadAllAsync and rm SubAnchor (#507)
* Keep sub alive when reading channel (#506)
* Add overload for empty requests (#502)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants