You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by "Kevan Jahanshahi (Jira)" <ji...@apache.org> on 2022/01/05 13:31:00 UTC

[jira] [Resolved] (UNOMI-534) Different condition handling between search and rules

     [ https://issues.apache.org/jira/browse/UNOMI-534?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevan Jahanshahi resolved UNOMI-534.
------------------------------------
    Fix Version/s: 2.0.0
       Resolution: Fixed

> Different condition handling between search and rules
> -----------------------------------------------------
>
>                 Key: UNOMI-534
>                 URL: https://issues.apache.org/jira/browse/UNOMI-534
>             Project: Apache Unomi
>          Issue Type: Task
>    Affects Versions: 1.6.0
>            Reporter: Francois Gerthoffert
>            Assignee: Serge Huber
>            Priority: Major
>             Fix For: 2.0.0, 1.6.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Hi,
> I used the search endpoint to create/verify the condition before creating the rule, but while I was able to return events using the search endpoints for a particular condition, I spent quite some time trying to understand why the same condition added to a rule would not match.
> Steps to reproduce (also here: [https://gist.github.com/Fgerthoffert/7069e82906b030a1e63a6d006c54ce7d] )
>  - Create an event and verify it is showing up with event-tail
>  
> {code:java}
> curl 'http://localhost:8181/eventcollector' \  -H 'Accept: application/json' \  --data-raw '{    "events":[{      "eventType":"click",      "scope":"digitall",      "target":{        "scope":"digitall",        "itemId":"model-y",        "itemType":"car"      },      "source":{        "scope":"digitall",        "itemId":"US 66",        "itemType":"road"      }    }],    "sessionId":"a37eca9f-b8a4-4e65-a8b7-79d6da48d566"}' {code}
>  
>  - Search for that event using eventPropertyCondition
>  
> {code:java}
> curl --request POST \  --url http://localhost:8181/cxs/events/search \  --user karaf:karaf \  --header 'Content-Type: application/json' \  --data '{	"limit": 10,	"condition": {	    "type": "eventPropertyCondition",           "parameterValues" : {               "propertyName" : "target.itemType",               "comparisonOperator" : "equals",               "propertyValue" : "car"            }        }}' {code}
> The event you just submitted should be part of the results.
>  
>  - Create a rule using that same eventPropertyCondition 
>  
> {code:java}
> curl --request POST \  --url http://localhost:8181/cxs/rules \  --user karaf:karaf \  --header 'Content-Type: application/json' \  --data '{  "metadata": {    "id": "testGroovyActionRule",    "name": "Test Groovy Action Rule",    "description": "A sample rule to test Groovy actions"  },  "condition": {    "type": "eventPropertyCondition",    "parameterValues" : {       "propertyName" : "target.itemType",       "comparisonOperator" : "equals",       "propertyValue" : "interest"    }  },  "actions": [    {      "type": "evaluateProfileAge",      "parameterValues": {}    }  ]}' {code}
>  - Open an ssh connection to Karaf and use rule-tail
>  
>  - Re-send the same event, you should NOT see any rule matching (this is the "issue")
>  - Update the rule you just created
> {code:java}
> curl --request POST \
>   --url http://localhost:8181/cxs/rules \
>   --user karaf:karaf \
>   --header 'Content-Type: application/json' \
>   --data '{
>   "metadata": {
>     "id": "testGroovyActionRule",
>     "name": "Test Groovy Action Rule",
>     "description": "A sample rule to test Groovy actions"
>   },
>   "condition": {
>     "type": "eventTypeCondition",
>     "parameterValues" : {
>        "eventTypeId" : "click"
>     }
>   },
>   "actions": [
>     {
>       "type": "evaluateProfileAge",
>       "parameterValues": {}
>     }
>   ]
> }' {code}
>  - Re-send the same event, you SHOULD see any rule matching
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)