Skip to Content
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
Explore Skills
Cloud Computing
Microsoft Azure
Amazon Web Services (AWS)
Google Cloud
Cloud Migration
Cloud Deployment
Cloud Platforms
Data Engineering
Data Warehouse
SQL
Apache Spark
Microsoft SQL Server
MySQL
Kafka
Data Lake
Streaming & Messaging
NoSQL Databases
Relational Databases
Data Science
Pandas
R
MATLAB
SAS
D3
Power BI
Tableau
Statistics
Exploratory Data Analysis
Data Visualization
AI & ML
Generative AI
Machine Learning
Artificial Intelligence (AI)
Deep Learning
Reinforcement Learning
Natural Language Processing
TensorFlow
Scikit-Learn
Hyperparameter Tuning
MLOps
Programming Languages
Java
JavaScript
Spring
Python
Go
C#
C++
C
Swift
Rust
Functional Programming
Software Architecture
Object-Oriented
Distributed Systems
Domain-Driven Design
Architectural Patterns
IT/Ops
Kubernetes
Docker
GitHub
Terraform
Continuous Delivery
Continuous Integration
Database Administration
Computer Networking
Operating Systems
IT Certifications
Security
Network Security
Application Security
Incident Response
Zero Trust Model
Disaster Recovery
Penetration Testing / Ethical Hacking
Governance
Malware
Security Architecture
Security Engineering
Security Certifications
Design
Web Design
Graphic Design
Interaction Design
Film & Video
User Experience (UX)
Design Process
Design Tools
Business
Agile
Project Management
Product Management
Marketing
Human Resources
Finance
Team Management
Business Strategy
Digital Transformation
Organizational Leadership
Soft Skills
Professional Communication
Emotional Intelligence
Presentation Skills
Innovation
Critical Thinking
Public Speaking
Collaboration
Personal Productivity
Confidence / Motivation
Features
All features
Verifiable skills
AI Academy
Courses
Certifications
Interactive learning
Live events
Superstreams
Answers
Insights reporting
Radar Blog
Buy Courses
Plans
Sign In
Try Now
O'Reilly Platform
book
Python语言及其应用(第2版)
by
Bill Lubanovic
March 2022
Intermediate to advanced
522 pages
13h 52m
Chinese
Posts & Telecom Press
Content preview from
Python语言及其应用(第2版)
298
|
第
17
章
•
另一种常见模式是
推送
(
push
),或者
扇出
(
fanout
):将数据发送给进程池中任意可用
的工作进程。比如位于负载均衡器之后的
We
b
服务器。
•
与推送相反的模式是
拉取
(
pull
)
,或者
扇入
(
fanin
):从一个或多个资源处接收数据。
比如从多个进程处获取文本消息并将其写入单个日志文件的日志记录程序(
logger
)。
•
还有一种与无线电或电视广播类似的模式:
发布
–
订阅
(
publish-subscribe
或
pub-sub
)。
在该模式中,发布者会发送数据。对于简单的“发布
–
订阅”系统
,所有的订阅者都会
接收到副本。订阅者大多能够指定自己感兴趣的数据类型(通常称为
话题
),发布者只
向其发送此类数据。因此,与推送模式不同,多个订阅者可能会收到特定的数据。如果
某主题没有订阅者,则该数据将被忽略。
下面先来看几个“请求
–
回应”模式和“发布
–
订阅”模式的例子。
17.3
“
请求
–
回应
”
模式
这是最为人熟知的模式。你向
DNS
、
Web
或电子邮件服务器发出请求,服务器回应请求,
或是告知你是否存在问题。
本书已经展示过如何使用
UDP
或
TCP
创建一些基本请求
,但是在套接字层面构建网络应
用的难度太大。来看看
ZeroMQ
能不能帮上忙。
17.3.1 ZeroMQ
ZeroMQ
是一个库,不是服务器。
ZeroMQ
有时被描述为
增强版套接字
(
socket on steroid
)。
ZeroMQ
套接字实现了你希望普通套接字所具有的功能:
•
交换完整的消息;
•
重建连接;
•
当发送方和接收方的节奏不一致时,对数据进行缓冲。 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial
You might also like
Python编程入门与实战
Posts & Telecom Press, Fabrizio Romano
Python实用技能学习指南
Posts & Telecom Press, Robert Smallshire, Austin Bingham
Python技术基础视频教程
保罗·J·戴特尔
Python面向对象编程指南
Posts & Telecom Press, Steven F. Lott
Publisher Resources
ISBN: 9787115586223