rocketmq底层网络使用的netty框架,类图如下

rocketmq netty底层设计

 

  RecketMQ通信模块的顶层结构是RemotingServer和RemotingClient,分别对应通信的服务端和客户端

首先看看RemotingServer

 1 public interface RemotingServer extends RemotingService {
 2 
 3     void registerProcessor(final int requestCode, final NettyRequestProcessor processor,
 4         final ExecutorService executor);
 5 
 6     void registerDefaultProcessor(final NettyRequestProcessor processor, final ExecutorService executor);
 7 
 8     int localListenPort();
 9 
10     Pair<NettyRequestProcessor, ExecutorService> getProcessorPair(final int requestCode);
11 
12     RemotingCommand invokeSync(final Channel channel, final RemotingCommand request,
13         final long timeoutMillis) throws InterruptedException, RemotingSendRequestException,
14         RemotingTimeoutException;
15 
16     void invokeAsync(final Channel channel, final RemotingCommand request, final long timeoutMillis,
17         final InvokeCallback invokeCallback) throws InterruptedException,
18         RemotingTooMuchRequestException, RemotingTimeoutException, RemotingSendRequestException;
19 
20     void invokeOneway(final Channel channel, final RemotingCommand request, final long timeoutMillis)
21         throws InterruptedException, RemotingTooMuchRequestException, RemotingTimeoutException,
22         RemotingSendRequestException;
23 
24 }
RemotingServer

相关文章:

  • 2022-12-23
  • 2021-04-15
  • 2021-05-22
  • 2021-09-08
  • 2021-07-18
  • 2021-08-23
  • 2021-07-10
猜你喜欢
  • 2022-01-10
  • 2021-12-11
  • 2021-10-22
  • 2021-10-28
  • 2021-12-01
  • 2021-06-24
相关资源
相似解决方案