dubbo ClientCall 源码
dubbo ClientCall 代码
文件路径:/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/call/ClientCall.java
/*
* 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 org.apache.dubbo.rpc.protocol.tri.call;
import org.apache.dubbo.common.stream.StreamObserver;
import org.apache.dubbo.rpc.TriRpcStatus;
import org.apache.dubbo.rpc.protocol.tri.RequestMetadata;
import java.util.Map;
/**
* ClientCall does not care about transport layer details.
*/
public interface ClientCall {
/**
* Listener for receive response.
*/
interface Listener {
/**
* Called when the call is started, user can use this to set some configurations.
*
* @param call call implementation
*/
void onStart(ClientCall call);
/**
* Callback when message received.
*
* @param message message received
*/
void onMessage(Object message);
/**
* Callback when call is finished.
*
* @param status response status
* @param trailers response trailers
*/
void onClose(TriRpcStatus status, Map<String, Object> trailers);
}
/**
* Send reset to server, no more data will be sent or received.
*
* @param t cause
*/
void cancelByLocal(Throwable t);
/**
* Request max n message from server
*
* @param messageNumber max message number
*/
void request(int messageNumber);
/**
* Send message to server
*
* @param message request to send
*/
void sendMessage(Object message);
/**
* @param metadata request metadata
* @param responseListener the listener to receive response
* @return the stream observer representing the request sink
*/
StreamObserver<Object> start(RequestMetadata metadata,
Listener responseListener);
/**
* @return true if this call is auto request
*/
boolean isAutoRequest();
/**
* Set auto request for this call
*
* @param autoRequest whether auto request is enabled
*/
void setAutoRequest(boolean autoRequest);
/**
* No more data will be sent.
*/
void halfClose();
/**
* Set compression algorithm for request.
*
* @param compression compression algorithm
*/
void setCompression(String compression);
}
相关信息
相关文章
dubbo AbstractServerCallListener 源码
dubbo BiStreamServerCallListener 源码
dubbo ObserverToClientCallListenerAdapter 源码
dubbo ReflectionAbstractServerCall 源码
dubbo ServerStreamServerCallListener 源码
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
7、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦