Message Rules Engine

Overview

The aim of this design is to go some way to providing a software component that can provide application- and situation- specific messages, in a flexible and configurable way.

The most simple-minded and least flexible way to implement the functional spec would be to code long if-then-else constructions. The most sophisticated way would be to use a full-fledged business rules product. Our design intends to fall somewhere between these two extremes, tending to the simpler end of the spectrum.

The key points of the design are:

  • Usable across different applications
  • Rules implemented in Java
  • One Java class per rule
  • Usage is flexible, determined by configuration
  • Message text maintainable by users

Terms & Definitions

Rule: a condition and an action. Each rule will be tagged with a Domain and a Context attribute.
Message Rule: special kind of rule where the action results in a single message in string form.
Domain: represents an app or subject area (e.g. Online Reg)
Context: represents a situation in which messages will be retrieved (e.g. for Online Reg: Display Subject Selections; Approval; Add Subject)

The Message Rules Engine will be the software component that applications interact with to retrieve messages. An app will supply a domain, a context, and a set of input data. It will receive a list of messages appropriate for the domain and context.

Sequence Diagram

The sequence diagram shows how the components of the message rules engine interact and how an application (e.g. Online Reg) interacts with the engine.

 
 
 
 
 
 

  1. The app calls the "gatherMessages" method of the Message Rules Engine, supplying domain and context.
  2. The rules engine retrieves rules metadata from the Message Rules service, based on the supplied domain and context. The metadata is a list of rules to be executed, and the associated messages.
  3. The rules engine then works through the rules metadata list, evaluating each rule in the list, and constructing a list of messages returned by each rule.
  4. Finally the rules engine returns the completed list of messages to the calling application.

Class Diagram

The class diagram shows the Java objects and their relationships, organized by package.


 
 
 
 
 
 

edu.mit.es.csf.rulesengine.message.service

This package holds the MessageRulesEngine itself, and the MessageRuleService class.

edu.mit.es.csf.rulesengine.message.rule

This package holds all the business rules, implemented in Java. Each rule implements the MsgRule interface.

edu.mit.es.csf.rulesengine.message.domain

This package holds the domain classes representing the message rule metadata.

edu.mit.es.csf.rulesengine.message.dao

This package holds data access objects for retrieving and writing message rule metadata from and to the database.

  • No labels