WangHan
2024-09-12 d5855a4926926698b740bc6c7ba489de47adb68b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package tech.powerjob.remote.framework.transporter;
 
import tech.powerjob.common.PowerSerializable;
import tech.powerjob.remote.framework.base.RemotingException;
import tech.powerjob.remote.framework.base.URL;
 
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutorService;
 
/**
 * 通讯器,封装与远程服务端交互逻辑
 *
 * @author tjq
 * @since 2022/12/31
 */
public interface Transporter {
 
    /**
     * Protocol
     * @return return protocol
     */
    Protocol getProtocol();
 
    /**
     *send message
     * @param url url
     * @param request request
     */
    void tell(URL url, PowerSerializable request);
 
    /**
     * ask by request
     * @param url url
     * @param request request
     * @param clz response type
     * @return CompletionStage
     * @throws RemotingException remote exception
     */
    <T> CompletionStage<T> ask(URL url, PowerSerializable request, Class<T> clz) throws RemotingException;
}