Describe Rule¶
It has two services :-
Get All rules
Get Rule by ID
Get All Rules¶
This service is used to get all the rules created by a tenant.
Following is the URL for describing all rules in CEP :-
GET http://<domain name>/cep/v2.0/rules
Following is the sample output body json for get CEP rules :-
[
{
"ruleName": "AggregationSlidingRule1",
"selectClause": "sum(s1.temp) as sumtemp",
"whereClause": "sumtemp > 40",
"groupByField": "sensor",
"triggerInterval": "1",
"windowDuration": "60",
"slidingDuration": "30",
"input": [{
"alias": "s1",
"topic": "test1",
"properties": [
"temp"
]
}],
"output": "outputaggre1"
},
{
"ruleName": "SmartHomeRule2",
"selectClause": "s1.securityStatus as securityStatus,s2.kitchentemp as kitchentemp,s3.homeactemp as homeactemp,s1.feature as feature,s1.starttime as s1time,s2.starttime as s2time,s3.starttime as s3time",
"whereClause": "securityStatus=='LOCKED' AND (kitchentemp - homeactemp) > 20",
"joinClause": "(s1.feature = s2.feature) AND abs(s1.starttime - s2.starttime) <= 30,(s2.feature = s3.feature) AND abs(s2.starttime - s3.starttime) <= 30",
"groupByField": "feature",
"triggerInterval": "60",
"input": [{
"alias": "s1",
"topic": "test1",
"properties": [
"securityStatus"
]
},
{
"alias": "s2",
"topic": "test2",
"properties": [
"kitchentemp"
]
},
{
"alias": "s3",
"topic": "test3",
"properties": [
"homeactemp"
]
}
],
"output": "outputjoin3"
}
]
Get Rule by ID¶
This service is used to get a particular routing rule with it’s rule id created by a tenant.
Following is the URL for describing a rule by ID in CEP :-
GET http://<domain name>/cep/v2.0/rules/{ruleId}
Following is the sample output body json for get CEP rule by ID :-
{
"ruleName": "JoiningSample1",
"selectClause": "s1.temp as currtemp,s2.humidity as currhumidity,s1.feature as feature,s1.starttime as s1time,s2.starttime as s2time",
"whereClause": "currtemp > 20 AND currhumidity > 80",
"joinClause": "(s1.feature = s2.feature) AND abs(s1.starttime - s2.starttime) <= 30",
"groupByField": "feature",
"triggerInterval": "30",
"input": [{
"alias": "s1",
"topic": "test1",
"properties": [
"temp"
]
},
{
"alias": "s2",
"topic": "test2",
"properties": [
"humidity"
]
}
],
"output": "outputjoin4"
}