WSO2 Private PaaS Communication Bus, which includes the Message Bus and the Real-time Event Bus, uses the Publish-Subscribe (pub/sub) messaging pattern to communicate among all the components (mainly the topic based pub/sub communications) in WSO2 Private PaaS. In this messaging pattern the components that send the messages are named as publishers; while, the components that receive the message are named as subscribers. The publishers group the messages into classes named topics and do not define where the published messages, which are namely events, need to be routed. Instead, the publishers maintain the topics, so that subscribers who are interested in a specific event, which is published in a topic, can subscribe to it. The actual communication process that takes place in WSO2 Private PaaS is illustrated in the diagram below. For more information on the event definitions, see Private PaaS Pub-Sub Event Definitions.
The pub/sub communication system helps to integrate all the components in loosely coupled manner; while, providing the advantage of adding or removing components without affecting to overall system. All components need to know only one well-known-member (WKA), which is the Message Broker. As a result, this enables WSO2 Private PaaS to be configured easily. In addition, the pub/sub communication enables WSO2 Private PaaS to effortlessly scale into multi-cloud.
Message Broker Topics
The following are the list of topics that reside in Message Broker:
Topology topic, which is in Message Broker, is the main topic that contains all the member information. Cloud Controller is the only publisher to this topic; while, the Load Balancer, Stratos Manager, Auto-scaler and Cartridge Agent subscribe to it.
The Topology topic contains the cluster details, member details (e.g., IP address), ports, member status (e.g., member starting and member active), partition details, Load Balancer details, and more. At any given time when looking at the Topology, it is possible to get a full picture of the system. Thereby, when Auto-scaler is taking decisions on scale up or down, it uses the Topology to get an accurate state of a particular cluster. Stratos Manager UI will also retrieve information from the Topology when displaying the graphical Topology for given cluster. The Load Balancers use the same Topology topic to add members to its load balancing cluster or clusters.
Instance Notifier topic
The Instance Notifier topic contains details on artifact updates that will be published to all the clusters created for the respective subscription, encrypted user credentials, repository information, and members and clusters that will be shutdown. ADC in Stratos Manager publishes the Artifact Update event, Instance Cleanup Member event, and Instance Cleanup Cluster event to the Instance Notifier topic and Cartridge Agent, which is inside the cartridge instance, is the only subscriber that will subscribe to this topic in order to listen to those events.
Instance Status topic
Cartridge Agent, which is in the cartridge instance, will publish events to the Instance Status topic. While, Cloud Controller and Stratos Manager will subscribe and listen to this topic. This topic will contain all the details regarding to cartridge instances such as, details about the activated ports of a spawned cartridge instance, the start up and subscription information of Cartridge Agent, indication of the maintenance mode of the instance, and the indication of the cartridge instance being shut down. The topic will contain the Instance Started event, Instance Activated event, Instance M aintenance Mode event and Instance Ready to Shut down event to hold a complete set of information about cartridge instances.
Summarized Health Stats topic
The Summarized Health Stats topic is used in the communication between the real-time event processing engine. Apache Stratos uses WSO2 Complex Event Processor (CEP) as its real-time event processing engine. CEP is the only publisher and Auto-scaler is the only subscriber to this topic. This topic contains details on the average value of the load average in the Average Load Average Event, average value of the memory consumption in the Average Memory Consumption Event, average value of the requests in-flight in the Average Requests In-flight Event and details about potential faulty members in the Member Fault Event. All these information will be used in the auto-scaling process.
The tenant topic holds all the information about the tenants in Apache Stratos. While, Stratos Manager is the only publisher and, Cartridge Agent and Load Balancer are the subscribers to this topic. Tenant topic holds information about the tenants and their status, in events such as Complete Tenant Event, Tenant Created Event, Tenant Subscribed Event, Tenant Updated Event, Tenant Unsubcribed Event, Tenant Removed Event, Subscription Domains Added Event and Subscription Domains Removed Event. These events will be published when a tenant is created, updated, removed, or when a tenant has subscribed/unsubscribed to/from a service or when domains are added/removed to/from a service.
Ping topic is used to check if Message Broker is active. In the pub/sub mechanism, after a component subscribes to a topic in Message Broker, it will maintain a passive connection and listen for new events that are published to that Topic. However, if the Message Broker were to go down, its subscribers will not be aware of this situation. Therefore, the subscriber will periodically (every 1 second) publish a Ping event to the Ping topic, which is in Message Broker, in order to check whether Message Broker is active.