目前业务需要长连接进行实时数据交互,同时已有的业务系统统一经过gateway网关调度,websocket服务是有状态服务,所以希望集成到同一个注册中心让gateway进行长连接的负载均衡转发和管理,以此写个demo进行测试 提供http请求api和长连接进行消息发送 首先连接需要登录后获取密钥以供进行鉴权和用户信息查询,客户端发起长连接请求在gateway中进行密钥鉴权和分发,记录用户连接netty服务信息 netty服务只做具体的消息组件,具体业务逻辑下沉回业务系统,采用mq进行通信,避免大量逻辑处理在消息组件服务导致消息发送阻塞 mq路由规则,业务系统订阅各自的业务队列,netty服务根据用户操作进行具体mq队列投递,而业务系统需要推送到客户端,先根据gateway管理用户连接信息获取路由队列key投递到mq,netty服务监听各自的队列 gateway底层也是采用netty来实现,所以很好的支持websocket长连接的路由,普通可使用断言配置来进行websocket服务的负载转发,但不符合我们的改造点 gateway自定义负载均衡...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with return
Contact return, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack