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.
📬 Issue #, if available:
The SDK supports streaming, but
lambda_http::Adapter
only handles buffered responses from Axum'sRouter
(i.e., aService
). This change allows direct streaming from Axum handlers/services, while specifying a custom runtime (i.e., with OTeL).For example,
lambda_http::run_with_streaming_response(app).await
doesn't allow you to specify a custom runtime. So this change helps to abstract out constructing the stream response and allowing a custom runtime.Related (ish):
✍️ Description of changes:
This PR exposes:
into_streaming_response
: Convert aService
into an AWS Lambda streaming response.Which was originally internal to the
run_with_streaming_response
function. There are no functional changes.There might be a more ergonomic way to expose an API like this, but I'm not aware. Happy to make changes as necessary so we're not exposing internals that may change in the future.
This is how you can use it with a custom runtime supporting OTeL:
🔏 By submitting this pull request
cargo +nightly fmt
.cargo clippy --fix
.