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

support duplexing pipeline #1

Closed
zavakid opened this issue Dec 26, 2021 · 3 comments
Closed

support duplexing pipeline #1

zavakid opened this issue Dec 26, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@zavakid
Copy link
Member

zavakid commented Dec 26, 2021

Implement a two-way pipeline to solve request/response-like scenarios.

e.g.

interface RequestOperation {
    Future invoke(Request request, RpcContext ctx)
}

interface ResponseOperation {
    Future onResponse(Request request, Response response, RpcContext ctx)
}


interface RPCHandler extends RequestOperation, ResponseOperation {
}

after apply @AutoPipeline to RPCHandler (we need to add some metadata for auto-pipeline) :

  • invoke method will start from head to tail
  • while onResponse will start from tail to head
  • may be invoke and onResponse operation will in separate interfaces, and some handler can just implement one of the interfaces
  • auto-pipeline will auto detect whether the handler is duplexing or not, and will call or skip the handler adaptively
@zavakid zavakid added the enhancement New feature or request label Jan 1, 2022
@zavakid
Copy link
Member Author

zavakid commented Jan 12, 2022

for the reason of compatibility, I think we need some annotations cooperate with the @AutoPipeline.

e.g. we can add two annotations: @Forward and @Reverse. here are the rules:

  • rule1: in the @AutoPipelineed interface's method, we can
    • add @Forward to apply the interface's method, the the annotated method will be called from head to tail
    • add @Reverse to apply the interface's method, the the annotated method will be called from tail to head
    • if no annotation to the method, we will search to the interface's methods, and enter to the rule2
    • @Forward and @Reverse are mutually exclusive, they cannot coexist
  • rule2: in the @AutoPipelineed interface, we can
    • add @Forward to apply the interface, the methods declared in this interface will be called from head to tail unless the method is annotated with @Forward or @Reverse in the method level
    • add @Reverse to apply the interface, the methods declared in this interface will be called from tail to head unless the method is annotated with @Forward or @Reverse in the method level
    • if no annotation to the interface, it equals to add @Forward to the interface, for compatibility
    • @Forward and @Reverse and mutually exclusive, they cannot coexist
  • rule3: the priority:
    • annotated to the method has the highest priority
    • annotated to the interface has the secondary priority

@zavakid
Copy link
Member Author

zavakid commented Jan 12, 2022

may be @Forward and @Reverse can be merged into one annotation @Direction, and it's value is forward and reverse, and the annotation follows the same rule above.

happyomg pushed a commit to happyomg/auto-pipeline that referenced this issue Jan 30, 2022
support duplex pipeline using @PipelineDirection, and add showcase for duplex pipeline.

foldright#1
zavakid added a commit that referenced this issue Feb 12, 2022
@zavakid
Copy link
Member Author

zavakid commented Feb 12, 2022

have commit some code to implement the idea, and a simple test, and kept the pipeline stateless.
We still need to work hard to finish this issue: add more test, clean code, write document. @oldratlee @happyomg

zavakid added a commit that referenced this issue Sep 4, 2022
@zavakid zavakid closed this as completed Sep 4, 2022
oldratlee pushed a commit that referenced this issue May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant