-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Triple stream support (issue#1332) (#1360)
* Add bi-stream call support for triple * triple pojo mode support stream --------- Co-authored-by: liujianjun.ljj <[email protected]>
- Loading branch information
1 parent
12fbfe1
commit 56ed259
Showing
27 changed files
with
2,001 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
core/api/src/main/java/com/alipay/sofa/rpc/transport/SofaStreamObserver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.alipay.sofa.rpc.transport; | ||
|
||
/** | ||
* StreamHandler, works just like gRPC StreamObserver. | ||
*/ | ||
public interface SofaStreamObserver<T> { | ||
|
||
/** | ||
* Sends a message, or defines the behavior when a message is received. | ||
* <p>This method should never be called after {@link SofaStreamObserver#onCompleted()} has been invoked. | ||
*/ | ||
void onNext(T message); | ||
|
||
/** | ||
* Note: This method MUST be invoked after the transport is complete. | ||
* Failure to do so may result in unexpected errors. | ||
* <p> | ||
* Signals that all messages have been sent/received normally, and closes this stream. | ||
*/ | ||
void onCompleted(); | ||
|
||
/** | ||
* Signals an exception to terminate this stream, or defines the behavior when an error occurs. | ||
* <p></p> | ||
* Once this method is invoked by one side, it can't send more messages, and the corresponding method on the other side will be triggered. | ||
* Depending on the protocol implementation, it's possible that the other side can still call {@link SofaStreamObserver#onNext(Object)} after this method has been invoked, although this is not recommended. | ||
* <p></p> | ||
* As a best practice, it is advised not to send any more information once this method is called. | ||
* | ||
*/ | ||
void onError(Throwable throwable); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
remoting/remoting-triple/build/generated/source/proto/main/java/triple/GenericProto.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.