Middleware Systems Research Group, University of Toronto, Canada

Rule-based Matching

PADRES brokers are modular software components that communicate using a set of queues: one input queue and multiple output queues. Each output queue represents a unique message destination, such as a neighbouring broker or client. The matching engine component is built using the JESS rule engine, and is responsible for forwarding messages from the input queue to the appropriate output queues. Message received by the broker are placed in the input queue waiting to be processed by the matching engine.

matching engine

The matching engine maintains the SRT (Subscription Routing Table) and PRT (Publication Routing Table) structures which are represented as Rete trees in the rule engine. In the PRT, subscriptions are mapped to rules, and publications are mapped to facts. An atomic subscription message is mapped to the antecedent of a rule, and the actions to be taken if the subscription matches are mapped to the consequent of the rule. Publications are inserted into the PRT as a fact. When a publication matches a subscription in the PRT, the publication's next hop destination is set to the last hop of the subscription, and it is placed into the corresponding output queue. For subscription messages, the matching engine first routes it based on the advertisements stored in the SRT, and, if there is an advertisement overlapping with the subscription, the subscription is inserted into the PRT as a rule.

Essentially, the broker uses a rule-based engine to both perform publish/subscribe matching and routing. This novel rule-based approach also allows for powerful subscription semantics and naturally enables composite subscriptions.