Skip to content

Add StreamMessage.of(inputStream)#4703

Merged
ikhoon merged 20 commits intoline:masterfrom
injae-kim:add-stream-message-input-stream
Mar 13, 2023
Merged

Add StreamMessage.of(inputStream)#4703
ikhoon merged 20 commits intoline:masterfrom
injae-kim:add-stream-message-input-stream

Conversation

@injae-kim
Copy link
Copy Markdown
Contributor

Related Issue #3937

Motivation:

static StreamMessage<HttpData> of(InputStream inputStream) {...}
  • It would be nice if we provide a way to convert an InputStream to a StreamMessage that splits the binary by the bufferSize.

Modifications:

  • Add StreamMessage.of(inputStream)
  • Add InputStreamStreamMessage and builder

Result:

@minwoox minwoox added this to the 1.23.0 milestone Feb 25, 2023
@injae-kim injae-kim force-pushed the add-stream-message-input-stream branch from a68980d to 7c7de9c Compare February 25, 2023 17:10
@ikhoon
Copy link
Copy Markdown
Contributor

ikhoon commented Feb 27, 2023

Copy link
Copy Markdown
Contributor

@ikhoon ikhoon left a comment

Choose a reason for hiding this comment

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

Overall, looks good.

@injae-kim
Copy link
Copy Markdown
Contributor Author

injae-kim commented Feb 27, 2023

// TODO(ikhoon): Add StreamMessage.of(InputStream)
Why don't you send a PR to https://github.com/softwaremill/tapir in which I left a TODO for this issue when a new version is released? 😉

oh~ after this PR is merged and released with new version, I'll also send PR to tapir to remove TODO~!

Comment on lines +135 to +144
if (this.blockingTaskExecutor != null) {
blockingTaskExecutor = this.blockingTaskExecutor;
} else {
final ServiceRequestContext serviceRequestContext = ServiceRequestContext.currentOrNull();
if (serviceRequestContext != null) {
blockingTaskExecutor = serviceRequestContext.blockingTaskExecutor();
} else {
blockingTaskExecutor = CommonPools.blockingTaskExecutor();
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see some duplications between this class and PathStreamMessage. Can we deduplicate as much as possible, potentially introducing a common supertype?

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.

Can we deduplicate as much as possible, potentially introducing a common supertype?

SGTM! but may I handle it with another issue & PR?
Cause I think we need some discussion about this issue 🙇

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.

If you want to handle it in a separate issue, it is okay to send a clean-up PR.

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'll send clean-up PR after this PR is merged~!

Copy link
Copy Markdown
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

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

In terms of correctness InputStreamStreamMessage looks good 👍 I think this PR is almost done! 🚀 Left only nit comments 🙇

Copy link
Copy Markdown
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

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

The changeset looks good to me (bar the comment #4703 (comment) which I think you'll be following up on) 😄
Thanks @injae-kim 👍 🙇 👍

Copy link
Copy Markdown
Contributor

@minwoox minwoox left a comment

Choose a reason for hiding this comment

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

Thanks! Left some suggestions and a question. 😄

Comment thread core/src/main/java/com/linecorp/armeria/common/stream/StreamMessage.java Outdated
Copy link
Copy Markdown
Contributor

@minwoox minwoox left a comment

Choose a reason for hiding this comment

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

Thanks a lot for adding this nice feature! 👍 🙇 👍

@injae-kim injae-kim force-pushed the add-stream-message-input-stream branch from 796198e to 5898efa Compare March 10, 2023 08:45
Copy link
Copy Markdown
Member

@trustin trustin left a comment

Choose a reason for hiding this comment

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

👍 once all others comments are addressed.

Copy link
Copy Markdown
Contributor

@ikhoon ikhoon left a comment

Choose a reason for hiding this comment

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

Awesome work! 🚀💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add StreamMessage.of(inputStream, bufferSize)

5 participants