auto commit
This commit is contained in:
parent
f5aaa576e4
commit
bf127b8e68
|
@ -19,21 +19,20 @@
|
|||
|
||||
消息生产者向消息队列中发送了一个消息之后,只能被一个消费者消费一次。
|
||||
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/b28a7b1e-bf5a-4e23-8be7-701eacef0111.jpg" width="600px"/> </div><br>
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/aaac1bbe-8e37-43d6-b645-cec16a092654_200.png" width="400px"/> </div><br>
|
||||
|
||||
## 发布/订阅
|
||||
|
||||
消息生产者向频道发送一个消息之后,多个消费者可以从该频道订阅到这条消息并消费。
|
||||
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/1b718cd5-7b1e-496c-9133-2bfd12bb5f89.jpg" width="600px"/> </div><br>
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/1daadd30-bd54-419e-a764-0dc95ac69653_200.png" width="400px"/> </div><br>
|
||||
|
||||
发布与订阅模式和观察者模式有以下不同:
|
||||
|
||||
- 观察者模式中,观察者和主题都知道对方的存在;而在发布与订阅模式中,发布者与订阅者不知道对方的存在,它们之间通过频道进行通信。
|
||||
- 观察者模式是同步的,当事件触发时,主题会调用观察者的方法,然后等待方法返回;而发布与订阅模式是异步的,发布者向频道发送一个消息之后,就不需要关心订阅者何时去订阅这个消息,可以立即返回。
|
||||
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/d011c697-2551-4968-ac51-e5e01a954204.jpg" width="600px"/> </div><br>
|
||||
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/40121fa5-cb5c-4add-9945-e087220cd039_200.png" width="450px"/> </div><br>
|
||||
|
||||
# 二、使用场景
|
||||
|
||||
|
|
BIN
docs/pics/1daadd30-bd54-419e-a764-0dc95ac69653_200.png
Normal file
BIN
docs/pics/1daadd30-bd54-419e-a764-0dc95ac69653_200.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
BIN
docs/pics/40121fa5-cb5c-4add-9945-e087220cd039_200.png
Normal file
BIN
docs/pics/40121fa5-cb5c-4add-9945-e087220cd039_200.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
BIN
docs/pics/aaac1bbe-8e37-43d6-b645-cec16a092654_200.png
Normal file
BIN
docs/pics/aaac1bbe-8e37-43d6-b645-cec16a092654_200.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
Loading…
Reference in New Issue
Block a user