Java-Interview-Advanced/docs/distributed-system/request-retry.md

17 lines
732 B
Markdown
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

订单服务 -> 创建订单
-> 库存服务 -> 扣减库存
-> wms服务 -> 通知发货
-> 积分服务 -> 增加积分
订单服务调用库存服务的时候,因为网络抖动,请求超时了,超过了秒钟,此时订单服务会重试,再次调用一下库存服务,发送一模一样的请求过去
比如说订单服务第一次请求库存服务库存服务其实是把扣减库存的业务逻辑执行成功了只不过网络问题导致响应迟迟没有返回给订单服务可能在1.2s之后返回了响应给订单服务
订单服务就认为请求超时了,他就再次发送了一个一模一样的请求给库存服务,库存服务可能会再次对库存进行扣减