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

Added support direct get batch API #680

Draft
wants to merge 10 commits into
base: server-2.11-features
Choose a base branch
from

Conversation

Ivandemidov00
Copy link
Contributor

@Ivandemidov00 Ivandemidov00 commented Nov 23, 2024

Note

Resolves #636

* Added implementation GetBatchDirectAsync
* Modify StreamMsgBatchGetRequest
* Added tests for directGetBatch
* Changed tests, set SkipIfNatsServer
* Applied dotnet format
@mtmk
Copy link
Collaborator

mtmk commented Dec 4, 2024

we need to wait for 2.11 server release before we can make any progress on this one.
edit: we're hoping to merge this into server 2.11 branch before server release #733

@mtmk mtmk self-assigned this Dec 4, 2024
@mtmk mtmk marked this pull request as draft December 4, 2024 08:08
@mtmk mtmk added this to the server 2.11 milestone Jan 27, 2025
@mtmk mtmk changed the base branch from main to server-2.11-features February 3, 2025 09:06
@mtmk
Copy link
Collaborator

mtmk commented Feb 4, 2025

adr https://github.com/nats-io/nats-architecture-and-design/blob/main/adr/ADR-31.md should be stable enough now we can move on with the implementation.

also java implementation can be used as reference: nats-io/nats.java#1239 use of MessageBatchGetRequest

@mtmk
Copy link
Collaborator

mtmk commented Feb 4, 2025

(in case the edit above is missed)
we're hoping to merge this into server 2.11 branch before server release (#733)

Copy link
Collaborator

@mtmk mtmk left a comment

Choose a reason for hiding this comment

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

a few comments after scanning through ADR-31. Also we need to get the branch up to speed with server-2.11-features branch. (this pr will be merged into that initially)

{
ValidateStream();

return _context.Connection.RequestManyAsync<StreamMsgBatchGetRequest, T>(
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should inline the RequestMany method here and handle error conditions as well.

/// <param name="includeEob"><c>true</c> to send the last empty message with eobCode in the header; otherwise <c>false</c></param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> used to cancel the API call.</param>
/// <exception cref="InvalidOperationException">There was an issue, stream must have allow direct set.</exception>
public IAsyncEnumerable<NatsMsg<T>> GetBatchDirectAsync<T>(StreamMsgBatchGetRequest request, INatsDeserialize<T>? serializer = default, bool includeEob = false, CancellationToken cancellationToken = default)
Copy link
Collaborator

Choose a reason for hiding this comment

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

we probably shouldn't expose includeEob since it's kind of internal. Do you see that being used somehow?

Copy link
Contributor Author

@Ivandemidov00 Ivandemidov00 Feb 8, 2025

Choose a reason for hiding this comment

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

Am I understanding correctly that we don't want to send eodCode related messages to the client?
Similar functionality is available in nats.java

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not if there is a use case for it but as long as it defaults to false I'm ok with it.

[JsonPropertyName("seq")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
[Range(ulong.MinValue, ulong.MaxValue)]
public ulong MinSequence { get; set; }
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think these names might've been update. Also inline with StreamMsgGetRequest we are calling this property Seq

https://github.com/nats-io/nats-architecture-and-design/blob/main/adr/ADR-31.md#request

Copy link
Contributor Author

@Ivandemidov00 Ivandemidov00 Feb 15, 2025

Choose a reason for hiding this comment

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

StreamMsgBatchGetRequest updated

@mtmk
Copy link
Collaborator

mtmk commented Feb 15, 2025

thanks @Ivandemidov00 👍 will check soon

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.

JetStream Batch Get Client support
2 participants