FioranoMQ Content Based Routing
Fiorano is the first to introduce an intelligent, standards-based message, content-based routing system.
This chapter outlines the content-based routing (CBR) problem that FioranoMQ CBR solves, a description of how to use CBR with samples, includes a description of the types of XML currently supported, a section covering the entire subset of XPath supported and a review of SQL 92 syntax for predicates. It is assumed here that the reader has a working knowledge of JMS.
Current pub/sub systems are group-based. In these systems, messages are classified as belonging to a certain group, referred to as a 'Topic'. Publishers are required to label each message with a topic name, while consumers subscribe to all messages on a particular topic. For example, a topic based pub/sub system for stock trading can define a message header field in the form of a name-value pair. Publishers post messages after labeling them, by setting a header property for each particular message. Subscribers can set preferences based on predetermined header properties, known as message selectors.
The default mechanism for routing messages in JMS is the use of Message Selectors. Message selectors are created in the form of header-properties of messages (for both PTP and Pub/Sub messaging). Client applications use an SQL-92 syntax language to specify the messages to be selected.
This approach has the following drawbacks:
- Requires high processing overheads on the publisher when setting message header properties appropriately.
- Limits the scope of messages to a domain specific set because the selectors for the subscribers have to be in accordance with the message header properties that areset. Thus, there is loss of flexibility in the selection process when it comes to changing domains.
The newer generations of pub/sub systems offer a better alternative to message-selection, known as content-based routing. These systems route messages to subscribers based on content instead of message-header properties. There is no overhead imposed on the publisher and prior knowledge of the domain is not required. Subscribers have the added flexibility of choosing filtering criteria along multiple dimensions, without requiring that groups be pre-defined.
In a trading example for group based systems, the subscribers can only select trades by issue name. In contrast, the content-based subscriber is free to use an orthogonal criterion, such as volume; or a collection of criteria, such as issue, price or volume. Management of content-based systems is simpler, as there is no administration overhead required to pre-define and maintain groups. Content-based routing systems enable efficient and scalable message distribution.
Going back to the stock trading example, consider a brokerage firm that can have thousands of subscribers interested in information on stock trade. Each subscriber has their own selection criteria based on individual requirements. In the event that a subscriber would like to be alerted when two stocks fall below a certain price:
MSFT stock falls below 55 AND ORCL stock falls below 15
In another event, a subscriber would like to be alerted when any one of three stocks change price and when the market volume exceeds a certain threshold:
(INTC < 21 OR CSCO > 20 OR GE > 32) AND DowVolume > 1,000,000,000
In an unrelated event, a subscriber would like to be alerted when a Formula 1 driver sets a new lap record at Imola:
(Car_Make = Ferrari) AND (Driver = Senna) AND (Circuit = Imola) AND (Lap Time < 1.01 mins)
The information a subscriber can be interested in is unlimited. Messages, events and alerts can be desired for items such as changes in inventory, new purchase orders, product delivery, receipt of a 'request-for-a-quote' and late breaking news.
To efficiently implement a pub/sub system with content-based routing, an efficient solution to the problem of matching a message against a large number of subscribers, referred to as the matching problem, needs to be solved. Additionally, there must be an efficient and easy to understand standards based language that enables subscribers to register and store their personal message preferences. FioranoMQ CBR provides these functions.