While many conversations involve direct communication between two parties, some conversations inherently involve multiple parties. Several patterns related to Discovery or Starting a Conversation, such as Consult Directory or Acquire Token First, involve a third party that helps two participants communicate. In most cacses, though, this third party steps aside once the remaining participants are ready to communicate with each other. In contrast, this chapter presents conversation patterns, in which in Intermediary sits inside the message stream being exchanged between participants. Lastly, some multi-party conversations consist of many participants communicating directly with each other without the involvement of an intermediary or a coordinator.
Correspondingly, one can differentiate such multi-party conversations into the following categories:
- Peer-to-peer conversations consists of multiple identical or similar participants that communicate directly with each other, e.g. Leader Election.
- Intermediaries acts as a connecting element between multiple participants. The message exchange between the participants runs through the intermediary. This chapter describes multiple such patterns.
- Coordinators drive the conversation by taking a central role that interacts with other participants, e.g. a Coordinated Agreement.
- Connectors facilitate a direct conversation between other participants. They do not sit inside the mesage exchange between participants but play a special role in supporting the conversation, e.g. by helping participants discover each other (Consult Directory).
Some multi-party conversations assume a fixed number of participants while others allow any number of participants. Some multi-party conversations even allow participants to join or leave the conversation "in flight", i.e. in the middle of the conversation.
Intermediaries are common in real life as well as in system design because they support a number of wide-spread use cases:
- Communication Restrictions: some participants may not be allowed to hold open communications and thus are required to use Intermediaries.
- Control: Use of intermediaries may be required for audit and control purposes. In many such cases, direct communication is restricted to enforce the usage of the intermediary.
- Convenience: intermediaries allow participants to communicate with a single partner instead of multiple partners, some of which may even come and go or be unavailable. Intermediaries also reduce the need for Discovery as the initiator only needs to know the identity of the Intermediary.
- Value-add: Real-life intermediaries may provide additional services beyond convenience, such as obtaining discounts from providers, covering legal risks, or selling items in smaller quantities, such as a retailer.
This chapter introduces the following intermediary patterns:
|Proxy||Forwards messages them to other participants.|
|Relay||Allows two participants who can only make outbound requests to engage in a two-way conversation.|
|Scatter-Gather||Propagates a request to multiple providers and aggregates the responses.|