Message Exchange Patterns: Architecture and Routing
This article explains the fundamental message exchange patterns—including publish‑subscribe, fanout, unidirectional and bidirectional streaming, as well as unicast, broadcast, multicast, and anycast routing—detailing their structures, use‑cases, and typical implementations in modern backend systems.
Conceptually, a message is an information exchange between a sender and one or more receivers, a core component of programming and system architecture since the mainframe era.
The article divides common message transport methods into two parts: "Message Exchange Architecture" describing how messages move between senders and receivers, and "Routing" covering the logic for delivering messages.
Message Exchange Architecture
Publish‑Subscribe
The Pub‑Sub model sends messages from a publisher to a broker’s topic (or exchange in RabbitMQ, topic in Kafka). Subscribers bind to the topic and receive messages asynchronously.
Pub‑Sub is simple and asynchronous, allowing the sender to continue other tasks while receivers process messages at their convenience.
Fanout
Fanout is similar to Pub‑Sub but delivers a copy of each message to all bound subscribers, effectively broadcasting the message to every interested party.
Twitter is a classic fanout example: a tweet is sent to all followers.
Unidirectional Streaming
In this mode the sender continuously streams data to the receiver, such as a mobile device sending GPS updates to a server.
Message brokers like Apache Kafka can manage such streams.
Bidirectional Streaming
Both sender and receiver continuously exchange messages, as seen in gRPC over HTTP/2, which maintains a persistent connection for two‑way data flow.
Routing
The following patterns describe how messages are routed between senders and receivers.
Unicast
Messages are sent from a sender to a specific receiver, exemplified by the HTTP request/response cycle.
Broadcast
The sender delivers a message to all receivers on the network; ARP is a typical broadcast implementation.
Multicast
Messages are sent to a defined group of receivers, such as IPTV streams to devices subscribed to a particular channel.
Anycast
Routers deliver a message to any one receiver that satisfies a set of criteria, often based on geographic proximity; content delivery networks (CDNs) commonly use anycast.
Conclusion
Developers and architects familiar with these patterns can quickly recognize their implementations in real systems, enabling concise communication during design discussions and fostering a shared understanding of modern enterprise messaging architectures.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
IT Architects Alliance
Discussion and exchange on system, internet, large‑scale distributed, high‑availability, and high‑performance architectures, as well as big data, machine learning, AI, and architecture adjustments with internet technologies. Includes real‑world large‑scale architecture case studies. Open to architects who have ideas and enjoy sharing.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
