Using the JMS API and XML in Content-Based Routing
By Todd Sundsted2003-12-20
A simple content-based routing system with agents
The figure below illustrates a simple content-based routing design.
This content-based routing system is built around two principal types of entities: routers (of which there is usually one) and agents (of which there is usually more than one).
Agents are the ultimate consumers of messages. An agent typically works on behalf of a user. An agent is responsible for publishing a user's interests with the routers of the system, and forwarding messages it receives from routers to the user.
Routers, as their name suggests, route messages. They examine the content of the messages they receive, apply rules to that content, and forward the messages as the rules dictate.
In addition to routers and agents, a system may also include harvesters. Although this article will not discuss them in detail, harvesters specialize in finding interesting information, packaging it up as a formatted message, and sending it to a router. Harvesters mine many sources of information including mail transfer agent (Sendmail or Microsoft Exchange Server) message stores, news servers, databases, and other legacy systems. Harvesting is an interesting subject in its own right, but I won't say more about it in this article.
The system described above is built on top of JMS. The JMS API provides a feature-rich substrate for building distributed message-based applications. Like most middleware, it provides functionality that would be challenging to write by hand.
At the heart of the system, represented in the figure by the oval, is the message broker. It manages multiple message queues on behalf of both the routers and the agents. It ensures that messages are delivered reliably and promptly to the interested entities.
Although JMS itself doesn't care, both the agents and the routers expect messages to be well-formed XML. The routers in particular use their understanding of the structure of well-formed XML to examine the messages for meaningful content.
Tutorial Pages:
» How to make sure information gets to the right people
» Messaging and the JMS API
» A simple content-based routing system with agents
» XML and XPath
» The code
» Conclusion
» Resources
IBM DeveloperWorks

