publish-subscribe(发布-订阅,常写作 pub/sub):一种消息通信/软件架构模式。发布者(publisher)把消息发布到某个“主题/频道(topic/channel)”,订阅者(subscriber)订阅感兴趣的主题后接收消息。发布者与订阅者彼此不必直接知道对方,实现解耦与异步传播。
/ˈpʌblɪʃ ˈsʌbskraɪb/
We use a publish-subscribe system to send notifications to users.
我们使用发布-订阅系统向用户发送通知。
In a publish-subscribe architecture, producers publish events to topics while multiple services subscribe and react independently, which improves scalability and decouples components.
在发布-订阅架构中,生产者把事件发布到主题上,多个服务各自订阅并独立响应,从而提升可扩展性并让组件解耦。
该术语由两个常见动词组合而成:publish(“发布、公布”)+ subscribe(“订阅、登记接收”)。在计算机与通信领域中,它被借用来描述“把消息发布到公共通道、由订阅者按需接收”的机制,强调发布者与接收者的分离。