-
Notifications
You must be signed in to change notification settings - Fork 200
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
Handle initial-response for event stream operations with RPC-bound protocols #4004
Handle initial-response for event stream operations with RPC-bound protocols #4004
Conversation
A new generated diff is ready to view.
A new doc preview is ready to view. |
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! Couple of questions, but no blockers
@@ -150,6 +162,74 @@ class FluentBuilderGenerator( | |||
} | |||
""", | |||
*scope, | |||
"epilogue" to |
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.
You might be saving this for the clean up PR at the end, but would it be worth adding a customization to the documentation of these operations detailing how they will work differently (or not at all?) with some of the interceptor hooks?
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.
You might be saving this for the clean up PR at the end
Good point, and I am. We need to first decide where to put that documentation so our customers can easily find it.
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.
Couple small questions/suggestions but overall looks good.
aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/IntegrationTestDependencies.kt
Outdated
Show resolved
Hide resolved
...oftware/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentBuilderGenerator.kt
Show resolved
Hide resolved
...en-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/AwsJson.kt
Show resolved
Hide resolved
codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Smithy.kt
Outdated
Show resolved
Hide resolved
This commit addresses #4004 (comment)
This commit addresses #4004 (comment)
This commit addresses #4004 (comment)
This commit addresses #4004 (comment)
This commit addresses #4004 (comment)
This commit addresses #4004 (comment)
A new generated diff is ready to view.
A new doc preview is ready to view. |
68ad62a
into
ysaito/support-event-stream-for-rpc-bound-protocols
Motivation and Context
Handles initial-response for event stream operations with an RPC-bound protocol in client SDKs. This makes event stream operations like SubscribeToShard in Kinesis and StartLiveTrail in CloudWatchLogs available in the Rust SDK, both of which are currently unavailable (RemoveEventStreamOperations.kt removes them via model transformation as unsupported).
Note that this PR is the first in a series and merged into a feature branch, not into the main branch. It intentionally does not address
TODO(EventStream)
or does not disable stalled stream protection for newly enabled event stream operations. It just focuses on implementing handlinginitial-response
messages. The next PR will most likely focus on handlinginitial-request
message, and the last PR will focus on code cleanup (hence if code review feedback is about code cleanup, I happily accept it but might defer it to the last PR).Description
At its core, handling initial-response for event stream operations is boiled down to using try_recv_initial during deserialization phase within the orchestrator. Here is the issue, though.
try_recv_initial
is an async method but functions/methods in the deserializer in client SDKs are all synchronous, causing an impedance mismatch between async and sync. This means we need to find an async context somewhere in which to be able to call thetry_recv_initial
method.To sidestep this design limitation, we customize the
send
method for event stream operations with RPC-bound protocols whose operation output contains an event stream member. The customization makes the epilogue of thesend
method look like the following (usingunwrap
for simplicity):This provides us with an async context where we can call
try_recv_initial
on an event stream member of an operation output struct and populate the non-event stream members of that struct. The downside though is that the operation output struct will be half-baked until the end ofsend
, with non-event stream members uninitialized, so interceptors after deserialization won't have access to complete the output struct. (it's todo to document somewhere for operations in question).The rest of the changes are for testing. Specifically
cloudwatchlogs
as a new service integration test (to teststart_live_trail
event stream operation)aws/sdk/integration-tests/transcribestreaming/tests/test.rs
have been moved toaws_smithy_eventstream
and gated behind thetest-util
cargo feature.initial-request
message is present and b) it is notTesting
cloudwatchlogs
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.