Skip to content
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

refactor: stream api #1658

Open
wants to merge 26 commits into
base: develop
Choose a base branch
from

Conversation

jayantxie
Copy link
Member

What type of PR is this?

refactor

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

(Optional) Translate the PR title into Chinese.

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:
zh(optional):

(Optional) Which issue(s) this PR fixes:

(optional) The PR that updates user documentation:

@jayantxie jayantxie requested review from a team as code owners January 7, 2025 03:33
client/client.go Outdated
sxStreamMW streamx.StreamMiddleware
sxStreamRecvMW streamx.StreamRecvMiddleware
sxStreamSendMW streamx.StreamSendMiddleware
eps cep.UnaryEndpoint
Copy link
Member

Choose a reason for hiding this comment

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

这个怎么和原来的 endpoint.Endpoint 兼容


type StreamOptions struct {
EventHandler stream.StreamEventHandler
RecvTimeout time.Duration
Copy link
Contributor

Choose a reason for hiding this comment

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

Recv/Send 都暴露了 ctx 参数,到底是使用 ctx 里的 deadline 还是这里的配置得斟酌下

client/client.go Outdated
kc.eps = mwchain(innerHandlerEp)
eps := mwchain(innerHandlerEp)

kc.eps = cep.UnaryChain(kc.opt.UnaryOptions.UnaryMiddlewares...)(func(ctx context.Context, req, resp interface{}) (err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

对于 Ping-Pong 调用,我们期望的是WithMiddlewareWithUnaryMiddleware 取代?
那么中间件的执行顺序也应该保持一致吧,我理解按照这里的拼装方式,UnaryMiddleware 先执行了

@jayantxie jayantxie force-pushed the refactor/streamx-api branch 6 times, most recently from 916a7a6 to 0693120 Compare February 11, 2025 09:03
@jayantxie jayantxie force-pushed the refactor/streamx-api branch 2 times, most recently from 4b98864 to 91effeb Compare February 11, 2025 11:13
@jayantxie jayantxie force-pushed the refactor/streamx-api branch from 91effeb to 326f232 Compare February 11, 2025 11:40
@jayantxie jayantxie force-pushed the refactor/streamx-api branch from 7c0df80 to 58976c6 Compare February 12, 2025 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants