fix(docs): correct tutorial code snippets for Go, Python, Java, Kotlin, and Node.js - #1936
Draft
msardara wants to merge 8 commits into
Draft
fix(docs): correct tutorial code snippets for Go, Python, Java, Kotlin, and Node.js#1936msardara wants to merge 8 commits into
msardara wants to merge 8 commits into
Conversation
Signed-off-by: Mauro Sardara <msardara@cisco.com>
- Fix slimrpc sub-package import: github.com/agntcy/slim-bindings-go/slimrpc -> github.com/agntcy/slim-bindings-go/v2/slim_rpc - Move Channel/Server constructors to slim_rpc package (not main slim package): slim.ChannelNewWithConnection -> slim_rpc.ChannelNewWithConnection slim.ChannelNewGroupWithConnection -> slim_rpc.ChannelNewGroupWithConnection slim.ServerNewWithConnection -> slim_rpc.ServerNewWithConnection - Fix non-existent methods: server.Serve() -> server.ServeBlocking(), channel.Close() -> channel.CloseBlocking(nil) - Fix stream type in unary-stream handler: slimrpc.RequestStream[T] -> slim_rpc.ServerStream[T] (server sends responses, not requests) - Fix serverNames slice type: []slim.Name -> []*slim.Name (NameFromString returns *Name)
Replace publish_async/publish_to_async with publish_and_wait_async/ publish_to_and_wait_async in tutorial-session.md, tutorial-receive.md, and tutorial-persistence.md. The _async variants return a CompletionHandle (fire-and-forget) while tutorials implied blocking behavior; the _and_wait_async variants are correct for sequential examples.
- Kotlin: publishAsync / publishToAsync return a CompletionHandle; add handle.waitAsync() calls in tutorial-session, tutorial-receive, and tutorial-persistence so examples block until delivery as intended - Kotlin: use createAppWithPersistenceAsync (not createAppWithPersistence) in tutorial-persistence to avoid blocking the coroutine dispatcher - Node.js: remove spurious await on app.setRoute() which is synchronous - slimrpc/tutorial-serve: fix Java/Kotlin server interface signatures for streaming methods — replace typed wrappers (TestSlimrpc.ServerResponseStream, ServerRequestStream, ServerBidiStream as constructor args) with raw RequestStream / ResponseSink params and helper-class wrappers inside the method body; replace Kotlin Flow API (which doesn't exist) with suspend functions using the same RequestStream/ResponseSink types - slimrpc/tutorial-client: fix Java/Kotlin client call signatures — all methods require (Duration, Map) timeout/metadata params; unary-stream uses ResponseStreamReader + ClientResponseStream.create wrapper; stream-unary uses finalizeStream() not closeAndReceive().get(); bidi-stream recv() returns StreamMessage sealed type, response bytes need parseFrom() - slimrpc/tutorial-multicast: fix Java/Kotlin group-client call pattern — needs Duration/null params, returns MulticastStreamMessage sealed type (not hasNext()/next() iterator), response bytes need parseFrom(), and source field is context().source() not sourceName()
- tutorial-serve.md Java: replace CompletableFuture.runAsync/supplyAsync (whose Runnable/Supplier lambdas cannot throw checked RpcException) with synchronous style matching the actual example; wrap parseFrom() calls in try/catch and rethrow as RuntimeException inside Function lambdas - tutorial-client.md Java: wrap parseFrom() in the ClientResponseStream lambda so it compiles (InvalidProtocolBufferException is checked) - tutorial-multicast.md Java: add missing <ExampleResponse> type parameter to MulticastResponseStream (generated TestGroupClient returns the typed variant, not the raw type); wrap parseFrom() in try/catch
Add Node.js code examples to tutorial-serve.md, tutorial-client.md, and tutorial-multicast.md based on the slim-bindings Node.js examples. Covers buf.gen.yaml code generation, AsyncIterable-based servicer implementation, all four RPC patterns (unary-unary, unary-stream, stream-unary, stream-stream), and group client multicast using TestGroupClient.
…utorials - tutorial-app.md: setRoute accepts bigint directly (no Number() cast needed) - tutorial-session.md: use SessionType enum values instead of string literals - tutorial-persistence.md: use Direction enum, IdentityProviderConfig/IdentityVerifierConfig constructors, and pass connId directly to subscribeAsync - tutorial-multicast.md: fix Python context attribute from source_name to source (RpcMessageContext.source is a Name object)
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
publish_and_wait_asyncand correct context attribute namesdeployment_namefield from config filesTest plan