There are two reasons why a software system might want to send messages to another system:
- to distribute computation
- to distribute information
Distributing computation is known as "task distribution": for example a load balancer.
Distributing information is known as "data distribution" or "message distribution": for example when different services subscribe to a topic.
Here are some important messaging patterns:
- procedure call is a trivial form of task distribution to a single node, done either locally or remotely with RPC
- the push-pull pattern (aka message queue) is a distributed, asynchronous form of task distribution
- the pub-sub pattern is a form of data distribution
Note that the push-pull pattern either distributes a task to a set of compute resources (fan-out only) or partitions a task into smaller sub-tasks which then need to be aggregated to form a result (fan-out followed by fan-in to a sink). An example of this second option is the MapReduce framework.