Navigation:  Messaging and Streaming > Publish-Subscribe > Message Routing >


Previous pageReturn to chapter overviewNext page

Message routing is the process of handing messages arriving from the publishers and delivering them to the subscribers. WebORB messaging destination configuration must reference a class responsible for messaging routing. The class must implement the following interface:

package weborb.v3types.core;
import java.util.ArrayList;
import java.util.Hashtable;
import weborb.messaging.v3.Subscriber;
public interface IServiceHandler
 // Called when the destination is being initialized by WebORB.
 public void initialize( IDestination destination ) throws Exception;
 // Called when a new subscriber registers to receive messages from the destination
 public void handleSubscribe( Subscriber subscriber, String clientId );
 // Called when the subscriber unsubscribes from the destination
 public void handleUnsubscribe( Subscriber subscriber, String clientId );
 // Called by polling subscribers only. The method should retrieve messages for the specific subscriber
 public ArrayList getMessages( Subscriber subscriber );
 // Called when a producer sends a message to the destination
 public void addMessage( Hashtable properties, Object message );


WebORB provides two message routing implementations out of the box: WebORB's internal and JMS-based message routing. Additionally, custom message routing can be implemented


The internal message routing does not have dependencies on any 3rd party messaging products and has a configurable message storage policy. The built-in implementation stores message in memory. To create a destination with the internal message processing add a destination as shown below in WEB-INF/flex/messaging-config.xml:

<destination id="DESTINATION_NAME">
   <channel ref="my-polling-amf"/>

Where DESTINATION_NAME is a unique name of your destination. The channel name referenced in the <channel> element identifies the channel which will be used by the Flex clients. Other types of clients (AJAX, .NET, Silverlight, Windows Phone 7, Android, iOS, etc) are not restricted to use the transport mechanism specified in the channel configuration. For additional information see the About Channels section.