Skip to content

Add client-side event stream support for RPC protocols - #862

Merged
kuhe merged 6 commits into
developfrom
kuhe/feat/event-streams
Oct 26, 2026
Merged

kuhe merged 6 commits into
developfrom
kuhe/feat/event-streams

Conversation

@kuhe

@kuhe kuhe commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

This PR adds event-stream support for JSON RPC protocols.

As a necessary prerequisite, it reconfigures the ClientProtocol hierarchy by inserting an abstract RPCClientProtocol base shared among Query, JSON RPC, and RPCv2 families.

@kuhe
kuhe force-pushed the kuhe/feat/event-streams branch 4 times, most recently from 92cbc15 to 8aa5693 Compare October 22, 2026 17:25
@kuhe
kuhe marked this pull request as ready for review October 22, 2026 19:32
@kuhe
kuhe requested a review from a team as a code owner October 22, 2026 19:32
Comment thread packages/smithy-http/src/smithy_http/aio/protocols.py Outdated
Comment thread packages/smithy-http/src/smithy_http/aio/protocols.py
Comment thread packages/smithy-http/src/smithy_http/aio/protocols.py Outdated
Comment thread packages/smithy-aws-core/tests/integration/test_rpcv2cbor_event_stream.py Outdated
@kuhe
kuhe force-pushed the kuhe/feat/event-streams branch 7 times, most recently from 5fe69fd to 1367b8e Compare October 23, 2026 19:10
Comment thread packages/smithy-http/src/smithy_http/aio/protocols.py Outdated
Comment thread packages/smithy-aws-event-stream/src/smithy_aws_event_stream/aio/__init__.py Outdated
Comment thread packages/smithy-core/src/smithy_core/aio/client.py Outdated
Comment thread packages/smithy-http/src/smithy_http/aio/protocols.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you plan to reuse this model for other cases in the future? If not, maybe we should give it a more specific name

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's intended to also be a scarecrow that collects model edge cases.

:param read_buffer_size: The buffer size in bytes to use when reading from streams.
Defaults to 8192 (8 KB).
:param trust_store_path: Path to a PEM CA bundle that overrides the default system

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this work with AWS_CA_BUNDLE? At the AWS layer?

@kuhe kuhe Oct 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I want to defer/punt this.

The full wiring is complicated by CRT not being the default transport. To select it, a user would have to explicitly instantiate it (at this point no enumerable value is used to indicate its selection), which would preclude the config from instantiating it in conjunction with the env's AWS_CA_BUNDLE.

Comment thread packages/smithy-aws-event-stream/src/smithy_aws_event_stream/aio/__init__.py Outdated
Comment thread packages/smithy-http/src/smithy_http/aio/protocols.py Outdated
kuhe added 4 commits October 26, 2026 14:35
Write the initial-request through the publisher so it is signed first in the event chain; default the output when initial-response is absent and replay the first event; key Accept off output_stream_member and Content-Type off input_stream_member; add a Simon Says duplex integration test.
Require HTTP/2 per event-stream operation from the protocol's modeled eventStreamHttp (threaded through ProtocolSettings via codegen); the CRT transport negotiates and pools it per request, so one client serves HTTP/1.1 operations and HTTP/2 event streams without configuration.
…d stream cleanup

Decide a missing initial-response by inspecting the output schema (required-without-default) instead of a deserialize exception; clear the publisher's pending initial-request only after a successful write; cancel the in-flight request task when event publisher creation fails; forward close() from the prefetched-event stream wrapper to the underlying source.
@kuhe
kuhe force-pushed the kuhe/feat/event-streams branch from 90fba3f to 4b97339 Compare October 26, 2026 14:38
@kuhe
kuhe force-pushed the kuhe/feat/event-streams branch from def966c to 12774e8 Compare October 26, 2026 15:52
@kuhe
kuhe merged commit 9080892 into develop Oct 26, 2026
11 checks passed
@kuhe
kuhe deleted the kuhe/feat/event-streams branch October 26, 2026 17:38
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.

3 participants