Publish/Subscribe messaging in a WebORB cluster is conceptually identical to publishing and receiving messages with a single WebORB server. The primary difference is in a cluster, WebORB automatically handles distribution of the published messages throughout all clustered nodes.
The center point of WebORB messaging is destination. Publishers send messages to a destination, subscribers subscribe to receive messages from a destination. In a clustered environment, publishers and subscribers can communicate with the same destination hosted on any WebORB instance. For example, a polling subscriber can subscribe to a destination on one WebORB server, but send subsequent polling requests to receive messages from any other WebORB server in the cluster. Since WebORB is responsible for the distribution of the published messages between the cluster nodes, subscriber's dependency on a single server is removed. This principle is applicable regardless of the mechanism used by a client to connect to to the server. It can be a polling, RTMP or a web socket-based client.
Statically Configured Clustered Destinations
To enable clustering support for a messaging destination, it must use a special messaging service handler when configured in [VIRT-DIR-ROOT/]WEB-INF/flex/messaging-config.xml. Consider the following destination configuration:
Notice the name of the class in the <message-service-handler> element - Weborb.Messaging.PubSub.Cluster.MessagingServiceHandler. The class is the handler responsible for synchronizing the state of destination's subscriptions and message distribution between all WebORB instances in the cluster.
Dynamic Clustered Destinations
A destination can be created dynamically while the product is running. To create a dynamic clustered destination, use the Dynamic Destination API. It is important to use the factory method with the service handler class name as an argument. The serviceHandlerClassName argument value must be "Weborb.Messaging.PubSub.Cluster.MessagingServiceHandler" or the name of a subclass of that class.
A clustered destination is automatically procured in the cluster. Any new WebORB instances joining the cluster after a dynamic destination is created will be brought up to the level of configuration so their setup matches all other WebORB nodes in the cluster.