Fundamentals 8 min read

Message Exchange Patterns: Architecture and Routing

This article explains the fundamental message exchange patterns—including publish‑subscribe, fan‑out, unidirectional and bidirectional streaming—as well as routing models such as unicast, broadcast, multicast, and anycast, illustrating each with common technology examples.

Architecture Digest
Architecture Digest
Architecture Digest
Message Exchange Patterns: Architecture and Routing

Conceptually, a message is an information exchange between a sender and one or more receivers, and message exchange has been a core part of programming and system design since the mainframe era.

Message Exchange Architecture

This section describes the mechanisms for moving messages between senders and receivers.

Publish‑Subscribe

The Pub‑Sub pattern has a publisher send messages to a broker’s topic (or exchange in RabbitMQ, topic in Kafka). Subscribers bind to the topic and receive messages asynchronously, making the model simple and lock‑free.

Fan‑out

Fan‑out is similar to Pub‑Sub but every subscriber bound to a topic receives a copy of each message, effectively distributing the message to all interested parties (e.g., Twitter sending a tweet to all followers).

Unidirectional Streaming

In this pattern the sender continuously streams data to the receiver, often via a broker that forwards the stream through a topic/inbox (e.g., Apache Kafka).

Bidirectional Streaming

Bidirectional streaming allows continuous message flow in both directions between sender and receiver, as exemplified by gRPC over HTTP/2.

Routing

This section covers how messages are routed from sender to receiver.

Unicast

Unicast sends a message to a single, specific receiver; HTTP request/response is a classic example.

Broadcast

Broadcast delivers a message to all receivers on a network; ARP is a typical implementation.

Multicast

Multicast forwards messages to a defined group of receivers, such as IPTV streaming to a channel.

Anycast

Anycast routes a message to any receiver that satisfies certain criteria, often based on geographic proximity; content delivery networks (CDNs) use this model.

Conclusion

Developers and architects who work with messaging will recognize many of these patterns; naming them consistently helps streamline design discussions and ensures shared understanding across teams.

ArchitectureStreamingroutingmessagingPub/Submulticastunicast
Architecture Digest
Written by

Architecture Digest

Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.