Hi all,

We are in the middle of process of implementing the feature for managing
business rules in WSO2 Stream Processor.

We have identified two kinds of users for this feature.
1) *Developer* : A person with knowledge in Siddhi and other related
technical aspects.
2)* Business User* : A person who is or is not familiar with underlying
technical aspects but still need to use them for his business use case.

Through Stream Processor's business rule feature,
a *developers* can create templated models for various scenarios as
templated siddhiApps/gadgets etc, and allow *business users* to customize
and instantiate business rules from them according to their use cases.


*Terminology : *

*RuleTemplate*     : Business rules are derived from these RuleTemplates.
*TemplateGroup*  : Developers can create a set of ruleTemplates and
categorize them according to their domains of usage. Such domain is called
a TemplateGroup.
*Skeleton*              : A templated single SiddhiApp/ Gadget.. which
belongs to the rule template. These are the templates of actual artifacts
which are going to be deployed after a business rule is instantiated from a
RuleTemplate.

*High Level Design*

[image: Inline image 1]

A TemplateGroup can have multiple RuleTemplates while a RuleTemplate having
one or many skeletons.


TemplateGroups, RuleTemplates and derrived BusinessRules have json
definitions.

Developers should create the definitions of RuleTemplats and save it in the
file system. (a sample definitions of TemplateGroup  and business rules are
attached herewith)

Then business users can instantiate business rules from those RuleTemplates.

We have planed to provide facilities to create business rules in two
different ways.

*1. Creating from templates :*
Business users are allowed to customize per-defined rule templates
according to their use cases.

*2. Creating business rules from scratch :*
Business users can define their own logic for business rules. However, in
this case user has to use input and output templates which may consist of
sources/sinks along with stream definitions.

After creating a business rule,  user can either save or save and then
deploy it.
Also user is able to perform functions like *redeploy, delete, edit *on
existing business rules.

If there are multiple nodes, developer who creates the RuleTemplates can
allocate a set of RuleTemplates for each nodes.
Then the actual artifacts derived from those templates will be deployed on
those respective nodes.

The configuration for Business Rules Manager comes to the *deployment.yaml*
of *dashboard runtime*.

A sample configuration is given below.

*business.rules:
  datasource: WSO2_BUSINESS_RULES_DB
  nodes:
  - 10.10.10.100:9090 <http://10.10.10.100:9090>:
    - stock-data-analysis
    - stock-exchange-input
    - stock-exchange-output
  queries:
    h2:
      ADD_BUSINESS_RULE: INSERT INTO business_rules VALUES (?, ?, ?)
      UPDATE_BUSINESS_RULE: UPDATE business_rules SET business_rule =
?, deployment_status = ? WHERE business_rules.uuid = ?
      UPDATE_DEPLOYMENT_STATUS: UPDATE business_rules SET
deployment_status = ? WHERE business_rules.uuid = ?
      RETRIEVE_BUSINESS_RULE: SELECT uuid, business_rule,
deployment_status FROM business_rules WHERE business_rules.uuid = ?
      RETRIEVE_ALL: SELECT * FROM business_rules;  *


We have defined a REST API for business rules and *SiddhiApps REST API* is
used to deploy/undeploy siddhi apps.

Please find related resources below.

   1. *User stories* :

   
https://docs.google.com/document/d/1w1w6VDagWLaOpkCzsz5adjLx8UhTeHkzS641dSM3pjQ/edit?usp=sharing
   2. *Business Rules REST API definition : *

   
https://docs.google.com/document/d/1B1TzVpNNOeB0qwMArf_zzczqAmAxITR1DLYoEnG_tQE/edit?usp=sharing
   3. *Design : *

   
https://docs.google.com/document/d/1PhdyPmlbxg8tWK-1WCRYOBG27wAZKv181xB5bXgBvEI/edit?usp=sharing
   4. *Samples definitions of RuleTemplates and BusinessRules.*

   
https://docs.google.com/document/d/1odn2yVpDMFfzGV5rJtmcRNkr79SRg3gGt_REgn7yGWA/edit?usp=sharing

Your feedback is highly appreciated.

Thanks and regards!
-- 
*Minudika Gammanpila*
Software Engineer - WSO2

Email   :  [email protected]
Mobile :  +94715659887 <+94%2071%20565%209887>
Web     :  http://wso2.com

<http://wso2.com> <http://wso2.com/signature>
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to