soul入门 第十二章 插件divide原理

183 阅读1分钟

soul入门 第十二章 插件divide原理

  • 作用:divide插件用来处理http协议请求转发。

  • 跑起来

​ 先来启动起来再说。首先启动admin,启动网关(端口9195),启动第一个http服务端口(8188),启动第二个端口为(8288)。如果不通过网关访问http服务,以第一个服务为例,路径说这样 http://192.168.1.3:8188/test/findByUserId?userId=1。如果通过网关访问则是这样 http://localhost:9195/http/test/findByUserId?userId=1,http是服务的请求前缀,连续请求三次,看网关日志,如下:

The request urlPath is http://192.168.1.3:8188/test/findByUserId?userId=1, retryTimes is 0 The request urlPath is http://192.168.1.3:8288/test/findByUserId?userId=1, retryTimes is 0 The request urlPath is http://192.168.1.3:8188/test/findByUserId?userId=1, retryTimes is 0

由日志看出,轮流调用两个服务。