Re: [Dev] [CEP] How to write a Siddhi query to get the total count from an Event Table
It doesn't give any errors, but the output look like, The query we have used as follows, from forCalculation join MarkovModel on forCalculation.initialState == MarkovModel.Initial_state select initialState as Event, sum(MarkovModel.countP) as totalCount group by forCalculation.initialState insert into ckStream; Thank you Regards *Supun Rasitha Muthutantrige* Software Engineer | Intern WSO2 Inc: http://wso2.com lean.enterprise.middleware Mobile: 0758374608 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] [CEP] How to write a Siddhi query to get the total count from an Event Table
Before executing the code, the Event table looks like, After executing the code, The results according to the above mentioned query Thank you Regards *Supun Rasitha Muthutantrige* Software Engineer | Intern WSO2 Inc: http://wso2.com lean.enterprise.middleware Mobile: 0758374608 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] [CEP] How to write a Siddhi query to get the total count from an Event Table
I have attached the execution plan and the input stream. The regex used to read from file adaptor, *state:(\S+)\.* Thank you Regards *Supun Rasitha Muthutantrige* Software Engineer | Intern WSO2 Inc: http://wso2.com lean.enterprise.middleware Mobile: 0758374608 ?xml version=1.0 encoding=UTF-8? executionPlan name=ExePlan_MarkovModel statistics=enable trace=enable xmlns=http://wso2.org/carbon/eventprocessor; descriptionExecution plan for building the markov mocdel/description siddhiConfiguration property name=siddhi.persistence.snapshot.time.interval.minutes0/property property name=siddhi.enable.distributed.processingfalse/property /siddhiConfiguration importedStreams stream as=inStream name=MarkovModel_inStream version=1.0.0/ /importedStreams queryExpressions![CDATA[ define table MarkovModel (State_Transition string, Initial_state string, countP double) from ('datasource.name'='FD_ToolBox_DB', 'database.name'='FDtoolbox', 'table.name'='MarkovModel'); define table MarkovModelAll (state string, countA double) from ('datasource.name'='FD_ToolBox_DB', 'database.name'='FDtoolbox', 'table.name'='MarkovModelAllCount'); from every a = inStream - b = inStream select a.Event as initialState, b.Event as transState, concat(a.Event,b.Event) as StateTransition insert into forCalculation; from forCalculation[((StateTransition!=MarkovModel.State_Transition) in MarkovModel)] select StateTransition, initialState, 1.0 as stateTrans_count insert into insertIntoModel; from forCalculation[((StateTransition==MarkovModel.State_Transition) in MarkovModel)]#window.length(1) join MarkovModel on forCalculation.StateTransition == MarkovModel.State_Transition select StateTransition, initialState, (MarkovModel.countP+1) as updatedState_count insert into updateModel; //from forCalculation#window.length(1) join MarkovModel //on forCalculation.initialState == MarkovModel.Initial_state from forCalculation join MarkovModel on forCalculation.initialState == MarkovModel.Initial_state select initialState as Event, sum(MarkovModel.countP) as totalCount group by forCalculation.initialState insert into ckStream; //from forCalculation join MarkovModel //on forCalculation.initialState == MarkovModel.Initial_state //select initialState as Event, sum(MarkovModel.countP) as totalCount //group by MarkovModel.Initial_state //insert into ckStream; //from inStream //select Event, count(Event) as totalCount //group by Event //insert into ckStream; from updateModel join MarkovModelAll on updateModel.initialState == MarkovModelAll.state select StateTransition, initialState, (updatedState_count/MarkovModelAll.countA) as prob insert into probStream; //from ckStream#window.length(1) join MarkovModel //on ckStream.Event == MarkovModel.Initial_state //select MarkovModel.State_Transition as StateTransition, MarkovModel.Initial_state as initialState, (MarkovModel.countP/convert(ckStream.totalCount,double)) as prob //insert into probCheck; ]]/queryExpressions exportedStreams stream name=insertIntoModel valueOf=insertIntoModel version=1.0.0/ stream name=updateModel valueOf=updateModel version=1.0.0/ stream name=ckStream valueOf=ckStream version=1.0.0/ stream name=probStream valueOf=probStream version=1.0.0/ /exportedStreams /executionPlan state:HTS. state:HFS. state:HTM. state:HTS. state:HTL. state:HFS. state:MTS. state:HTS. state:HTL. state:MFM. state:HTS. state:HFS. ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
[Dev] [CEP] How to write a Siddhi query to get the total count from an Event Table
Hii all, There is a mysql table with the following content. The format of the in stream state:HTS state:HFS state:HTM state:HTS state:HTL state:HFS state:MTS state:HTS state:HTL state:MFM state:HTS state:HFS The following siddhi query is used to populate the above table. -- define table MarkovModel (State_Transition string, Initial_state string, countP double) from ('datasource.name'='FD_ToolBox_DB', 'database.name'='FDtoolbox', 'table.name'='MarkovModel'); from every a = inStream - b = inStream select a.Event as initialState, b.Event as transState, concat(a.Event,b.Event) as StateTransition insert into forCalculation; from forCalculation[((StateTransition!=MarkovModel.State_Transition) in MarkovModel)] select StateTransition, initialState, 1.0 as stateTrans_count insert into insertIntoModel; from forCalculation[((StateTransition==MarkovModel.State_Transition) in MarkovModel)]#window.length(1) join MarkovModel on forCalculation.StateTransition == MarkovModel.State_Transition select StateTransition, initialState, (MarkovModel.countP+1) as updatedState_count insert into updateModel; -- Want to know how get the total count of *Initial_state*'s from the above table as a continuation to the above query. Ex: HFS - 2 HTL - 2 HTM - 1 HTS - 4 MFM - 1 MTS - 1 Would appreciate any suggestions. Thank you Regards *Supun Rasitha Muthutantrige* Software Engineer | Intern WSO2 Inc: http://wso2.com lean.enterprise.middleware Mobile: 0758374608 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] [CEP] How to write a Siddhi query to get the total count from an Event Table
Hi seshika, Yes tried that but it doesn't give the desired output. The query that we have used as follows, from forCalculation#window.length(1) join MarkovModel on forCalculation.initialState == MarkovModel.Initial_state select initialState as Event, sum(MarkovModel.countP) as totalCount insert into ckStream; this was tried using group by as well, Still it doesn't give the result any thoughts? Thank you Regards *Supun Rasitha Muthutantrige* Software Engineer | Intern WSO2 Inc: http://wso2.com lean.enterprise.middleware Mobile: 0758374608 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] [Siddhi] Counting Patterns
Hi Suho, Yes, the 3rd example worked for the above given scenario. And when more than 3 addresses are allowed, what Seshika has mentioned can also be used. Thank you, Regards *Supun Rasitha Muthutantrige* Software Engineer | Intern WSO2 Inc: http://wso2.com lean.enterprise.middleware Mobile: 0758374608 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] [Siddhi] Counting Patterns
Hi seshika Have you found any scalable approaches on this? We also came across some similar scenarios. Thank you Regards *Supun Rasitha Muthutantrige* Software Engineer | Intern WSO2 Inc: http://wso2.com lean.enterprise.middleware Mobile: 0758374608 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] [Siddhi] Counting Patterns
One such scenario is, shipping to multiple addresses using a single credit card. The merchant should be able to set a max no of addresses. So when the no increases, query become complicated. Let's assume all the following transactions have the same credit card no, but with different addresses and the max address count is 2. I have only included the addresses 1. Colombo 2. Kandy 3. Colombo 4. Kandy 5. Matara 6. Kandy 7. Colombo Here according to the allowed address count, the 5th transaction should be fraudulent (which is addressed to Matara) and all the other transactions done from there after should also be fraudulent as well (6,7). This can be captured from using what Rajeev has mentioned. But as I mentioned earlier, when the max address count increases, using that query would get complicated. So wanted to know how to scale by using counting patterns accordingly. Thank you Regards *Supun Rasitha Muthutantrige* Software Engineer | Intern WSO2 Inc: http://wso2.com lean.enterprise.middleware Mobile: 0758374608 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] [Siddhi] Counting Patterns
Hi Suho, The scenario is, we should be able to trigger an alert when multiple shipping's are being caused by applying a single credit card. In our case this should occur when third distinct address pop's up in an event. So in my previous example, if we consider the 4th transaction which is, *Colombo -- Kandy -- Colombo -- Kandy(4th)* This 4th transaction is not fraudulent since the credit card has been used only for shipments for two distinct addresses (Kandy Colombo). But when the 5th transaction occurs from the same card, *Colombo -- Kandy -- Colombo -- Kandy -- Matara(5th)* The 5th transaction should be fraudulent, as it is the 3rd distinct address (Matara, kandy Colombo) that is being shipped by using the same credit card. Thereafter, any transactions executed by the same credit card should also be fraudulent, as three distinct destinations are already available. So that is the requirement and I will use your examples and let you know. Thank you for the input suho. Thank you, Regards. *Supun Rasitha Muthutantrige* Software Engineer | Intern WSO2 Inc: http://wso2.com lean.enterprise.middleware Mobile: 0758374608 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
[Dev] [CEP] Appropriate Regex values to map CSV file fields into an event stream
Hii, I am using a csv file which consists of several fields similar to pin12345678 ip192.168.10.2 mailt...@abc.com addcolombo pin34345678 ip192.168.10.3 mailt...@abc.com addcolombo1 pin12345678 ip192.168.10.2 mailt...@abc.com addcolombo2 and so on *Note: Ignore some_text fields, used only to describe the fields that are being used* Each horizontal line represents an event in an event stream and the fields needs to be mapped to the relevant payload attributes through an event builder. I would like to know the most appropriate regex values for this mapping. I have tried several regex values, but end up getting *java.lang.IllegalStateException: No match found* exception. Would appreciate any help. Thank you. Regards *Supun Rasitha Muthutantrige* Software Engineer | Intern WSO2 Inc: http://wso2.com lean.enterprise.middleware Mobile: 0758374608 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] Error establishing data source connection, Communications link failure
Hi Manoj, The error occurred when I attempt to link to a mysql database using the CEP. The following error message was shown when the connection was tested. Error-- Error establishing data source connection: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. - After I allowed the permission as Yasassri mentioned the problem resolved. Thank you, Regards. *Supun Rasitha Muthutantrige* *supunrIntern WSO2 Inc: http://wso2.com http://wso2.com lean.enterprise.middleware* *Mobile: 0758374608* ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
[Dev] Error establishing data source connection, Communications link failure
Hi all, While attempting to relate to an RDBMS data source [Driver*:* *com.mysql.jdbc.Driver*, URL: *jdbc:mysql://localhost:3306/testdb*] in CEP, the following error occurs Error--- Error establishing data source connection: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. Error stack-- [2014-10-15 09:21:52,227] ERROR - {DataSourceRepository} Error establishing data source connection: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. org.wso2.carbon.ndatasource.common.DataSourceException: Error establishing data source connection: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader.testDataSourceConnection(RDBMSDataSourceReader.java:71) at org.wso2.carbon.ndatasource.core.DataSourceRepository.testDataSourceConnection(DataSourceRepository.java:510) at org.wso2.carbon.ndatasource.core.services.NDataSourceAdminService.testDataSourceConnection(NDataSourceAdminService.java:89) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) End Error stack-- I have changed the *bind-address* in *my.cnf *file, according to my machine ip as well. Appreciate any support to solve this error. Regards *Supun Rasitha Muthutantrige**supunr* *Intern WSO2 Inc: http://wso2.com http://wso2.com lean.enterprise.middleware* *Mobile: 0758374608* ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] Error establishing data source connection, Communications link failure
Hi Rajeevan, Yes, I tried by adding *mysql-connector-Java-5.1.33. tar.gz*, and then with only having *mysql-connector-Java-5.1.33-bin.jar* in that folder. But neither worked. Regards *Supun Rasitha Muthutantrige* *supunr* *Intern WSO2 Inc: http://wso2.com http://wso2.com/lean.enterprise.middleware* *Mobile: 0758374608* ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] Error establishing data source connection, Communications link failure
Hi Yasassri, It worked :) Thank you all for helping me out with this. Regards *Supun Rasitha Muthutantrige* *supunr* *Intern * *WSO2 Inc: http://wso2.com http://wso2.com* *lean.enterprise.middleware* *Mobile: 0758374608* ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] ClassNotFoundException : org.wso2.carbon.student.mgt.GetStudents when creating carbon component.
Hi Hemika, Can you attach the StudentManagerClient.java file. It seems the problem is caused from there. Regards *Supun Rasitha Muthutantrige* *supunrWSO2 Inc: http://wso2.com http://wso2.com lean.enterprise.middleware* *Mobile: 0758374608* ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] How to add a link to a different page in a carbon ui component
Hi Lahiru, DO you want to link two .jsp pages? From one of your .jsp pages to another one? is that what you are trying to achieve? Regards *Supun Rasitha Muthutantrige* *supunr WSO2 Inc: http://wso2.com http://wso2.com lean.enterprise.middleware* *Mobile: 0758374608* ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] How to add a link to a different page in a carbon ui component
you can simple add an anchor tag in you jsp file. or you can add a button to redirect it into the relevant page Anchor tag a href=*your_jsp**link text*/a *Supun Rasitha Muthutantrige* *supunrIntern WSO2 Inc: http://wso2.com http://wso2.com lean.enterprise.middleware* *Mobile: 0758374608* ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] How to add a link to a different page in a carbon ui component
Is your problem solved then? Regards *Supun Rasitha Muthutantrige* *supunrIntern WSO2 Inc: http://wso2.com http://wso2.com lean.enterprise.middleware* *Mobile: 0758374608* ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] [DEV] WSDL error when writing the carbon component
Hii Nishali, Just check your wsdl again. It seems there is a problem in saving it. Try to save it from the browser as a wsdl file instead of copying and then saving in a different file. Regards *Supun Rasitha Muthutantrige* *supunrWSO2 Inc: http://wso2.com http://wso2.com lean.enterprise.middleware* *Mobile: 0758374608* ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
[Dev] Could not resolve dependencies Error in writing Student-Manager Carbon component
Hii, I went through the following article to write a Carbon Component [01]. http://wso2.com/library/tutorials/2014/03/how-to-write-a-wso2-carbon-component/ I have completed most of the steps in [01], but when trying to *mvn clean install* the *pom.xml* under *org.wso2.carbon.student.mgt.ui*, following error occurs. - *Begin Error Stack* -- --- [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for org.wso2.carbon:org.wso2.carbon.student.mgt.ui:bundle:4.2.0 [WARNING] 'build.plugins.plugin.version' for org.apache.felix:maven-bundle-plugin is missing. @ line 24, column 12 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] [INFO] Building WSO2 Carbon - Student Manager UI Component 4.2.0 [INFO] [INFO] [INFO] BUILD FAILURE [INFO] [INFO] Total time: 1.409 s [INFO] Finished at: 2014-10-01T10:04:28+05:30 [INFO] Final Memory: 14M/206M [INFO] [ERROR] Failed to execute goal on project org.wso2.carbon.student.mgt.ui: Could not resolve dependencies for project org.wso2.carbon:org.wso2.carbon.student.mgt.ui:bundle:4.2.0: Failed to collect dependencies at org.wso2.carbon:org.wso2.carbon.student.mgt.stub:jar:4.2.0: Failed to read artifact descriptor for org.wso2.carbon:org.wso2.carbon.student.mgt.stub:jar:4.2.0: Failure to find org.wso2.carbon:student-manager-components:pom:4.2.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced - [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException - *End Error Stack* - The relevant pom.xml as follows *Start org.wso2.carbon.student.mgt.ui / pom.xml* -- ?xml version=1.0 encoding=UTF-8? project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd; parent artifactIdstudent-manager-components/artifactId groupIdorg.wso2.carbon/groupId version4.2.0/version /parent modelVersion4.0.0/modelVersion artifactIdorg.wso2.carbon.student.mgt.ui/artifactId packagingbundle/packaging nameWSO2 Carbon - Student Manager UI Component/name dependencies dependency groupIdorg.wso2.carbon/groupId artifactIdorg.wso2.carbon.student.mgt.stub/artifactId version4.2.0/version /dependency /dependencies build plugins plugin groupIdorg.apache.felix/groupId artifactIdmaven-bundle-plugin/artifactId extensionstrue/extensions configuration instructions Bundle-SymbolicName${pom.artifactId}/Bundle-SymbolicName Bundle-Name${project.artifactId}/Bundle-Name Export-Package org.wso2.carbon.student.mgt.* /Export-Package Import-Package *;resolution:=optional /Import-Package Carbon-ComponentUIBundle/Carbon-Component /instructions /configuration /plugin /plugins /build /project - *End org.wso2.carbon.student.mgt.ui / pom.xml* -- Please Help. Regards *Supun Rasitha Muthutantrige* *supunrWSO2 Inc: http://wso2.com http://wso2.com lean.enterprise.middleware* *Mobile: 0758374608* ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] Could not resolve dependencies Error in writing Student-Manager Carbon component
@Rajith Thank you, but the problem still exists. Error it gives this time - *Begin Error Stack* -- [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for org.wso2.carbon:org.wso2.carbon.student.mgt.ui:bundle:4.2.0 [WARNING] 'build.plugins.plugin.version' for org.apache.felix:maven-bundle-plugin is missing. @ line 24, column 12 [WARNING] The expression ${pom.artifactId} is deprecated. Please use ${project.artifactId} instead. [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] [INFO] Building WSO2 Carbon - Student Manager UI Component 4.2.0 [INFO] [INFO] [INFO] BUILD FAILURE [INFO] [INFO] Total time: 1.428 s [INFO] Finished at: 2014-10-01T12:06:25+05:30 [INFO] Final Memory: 12M/145M [INFO] [ERROR] Failed to execute goal on project org.wso2.carbon.student.mgt.ui: Could not resolve dependencies for project org.wso2.carbon:org.wso2.carbon.student.mgt.ui:bundle:4.2.0: Failed to collect dependencies at org.wso2.carbon:org.wso2.carbon.student.mgt.stub:jar:4.2.0: Failed to read artifact descriptor for org.wso2.carbon:org.wso2.carbon.student.mgt.stub:jar:4.2.0: Failure to find org.wso2.carbon:student-manager-components:pom:4.2.0 in http://maven.wso2.org/nexus/content/groups/wso2-public/ was cached in the local repository, resolution will not be reattempted until the update interval of wso2-nexus has elapsed or updates are forced - [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException - *End Error Stack* -- Thank you, Regards. *Supun Rasitha Muthutantrige* *supunrWSO2 Inc: http://wso2.com http://wso2.com lean.enterprise.middleware* *Mobile: 0758374608* ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] Could not resolve dependencies Error in writing Student-Manager Carbon component
Thank you all. Finally it worked :) Regards *Supun Rasitha Muthutantrige* *supunrWSO2 Inc: http://wso2.com http://wso2.com lean.enterprise.middleware* *Mobile: 0758374608* ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev