Publish-subscribe is a messaging paradigm:
- Producers send messages to specific brokers rather than directly to consumers.
- Brokers cache messages sent by producers and then actively push them to subscribed consumers or pull them.
The system architectures use this pattern to decouple or handle high traffic scenarios.
In Apache APISIX, the most common scenario is handling north-south traffic from the server to the client. Combining it with a publish-subscribe system, we can achieve more robust features, such as real-time collaboration on online documents, online games, etc.
Currently, Apache APISIX supports WebSocket communication with the client, which can be any application that supports WebSocket, with Protocol Buffer as the serialization mechanism, see the protocol definition.
Apache APISIX implement an extensible pubsub module, which is responsible for starting the WebSocket server, coding and decoding communication protocols, handling client commands, and adding support for the new messaging system.
- Add new commands and response body definitions to
- Add a new option to the
schemeconfiguration item in upstream
- Add a new
schemejudgment branch to
- Implement the required message system instruction processing functions
- Optional: Create plugins to support advanced configurations of this messaging system
TODO, an example will be added later to point out how to support other messaging systems.