That's great!... On 28 August 2015 at 18:25, Lakini Senanayaka <[email protected]> wrote:
> Hi Lasantha, > > I have corrected the issue you mentioned above.Now the events are > processing correctly. > > Thank you. > > On Tue, Aug 25, 2015 at 11:38 PM, Lasantha Fernando <[email protected]> > wrote: > >> Hi Lakini, >> >> I earlier assumed that you would be using the latest Siddhi-3.0.0 which >> has the concept of different ExecutionPlanRuntimes. But looking at the >> code, it seems you are using Siddhi-2.1.0.wso2v1. In that case, my >> explanation about ExecutionPlanRuntime would be incorrect since >> Siddhi-2.1.0 did not have ExecutionPlanRuntimes. For Siddhi-2.1.0, >> >> 1. Multi-threading when sending events would work. But Siddhi itself >> would not streamline the events coming from different threads and handover >> the work to Siddhi's own threads. i.e. the thread that sends the event >> would be involved in processing and send the output event (unless >> siddhi-windows were involved). The Siddhi engine itself was not >> multithreaded, but it can handle events coming in from multiple threads. It >> is thread-safe. >> >> 2. When modifying queries using multiple threads, the queries were >> tracked by the query-id which involved a generated UUID. So if you added >> similar queries to the same SiddhiManager instance, it would be added as >> two different queries. To edit a query, you would have to remove the old >> query first using its query id and add the modified query. >> >> But looking at your code, it seems the two client apps are calling the >> IEdgeAnalyticsService.Stub.getService() method and in that method you are >> creating a new CEP instance each time, which in turn creates a new Siddhi >> manager. Given that, your two client apps would deploy their queries on two >> different Siddhi instances. >> >> However, if there is only one instance of the service itself, calling the >> RemoteService.getService() method simply creates a new CEP instance and >> assigns that to the instance variable. i.e. the second call would overwrite >> the reference to the CEP instance created by the first call. So definitely >> when you call the RemoteService.sendData() method, it would send those >> events to the CEP/Siddhi instance that was created by the second call, even >> if it is the first client that is sending the events. >> >> I think there is an issue in simply assigning a new instance to the 'cep' >> variable in com.example.lakini.edgeanalyticsservice.EdgeAnalyticsService >> IEdgeAnalyticsService.Stub.getService() method. >> >> Can you please correct this issue and see whether events are being >> processed correctly? >> >> Thanks, >> Lasantha >> >> On 25 August 2015 at 18:53, Lakini Senanayaka <[email protected]> wrote: >> >>> Hi all, >>> >>> As per request I have shared my source code.You can find my sample >>> project [1] from this link and I have point out the place[2][3][4] it will >>> be easier to you to understand. >>> >>> [1] - sample edgeAnalyticsService >>> <https://github.com/Lakini/EdgeAnalyticServiceSample/> >>> [2] - EdgeAnalyticsService >>> <https://github.com/Lakini/EdgeAnalyticServiceSample/blob/master/EdgeAnalyticsService/app/src/main/java/com/example/lakini/edgeanalyticsservice/CEP.java#L37> >>> [3] - ClientApp1 >>> <https://github.com/Lakini/EdgeAnalyticServiceSample/blob/master/ClientApp/app/src/main/java/com/example/lakini/edgeanalyticsservice/MainActivity.java#L58> >>> [4] -ClientApp2 >>> <https://github.com/Lakini/EdgeAnalyticServiceSample/blob/master/Second/app/src/main/java/com/example/lakini/edgeanalyticsservice/MainActivity.java#L58> >>> >>> Thank you. >>> >>> On Tue, Aug 25, 2015 at 4:30 PM, Lasantha Fernando <[email protected]> >>> wrote: >>> >>>> Hi Srinath, Lakini, >>>> >>>> Siddhi is thread safe when sending events. You can send events via >>>> multiple threads without any issue. >>>> >>>> When changing queries via multiple threads, the execution plan runtime >>>> of the previous query would have to be shutdown manually. Looking at the >>>> current code, it seems that an ExecutionPlanRuntime instance would be >>>> created after the query is parsed and that would be put to a >>>> ConcurrentHashMap with the execution plan name (specified via annotations) >>>> as the key. So if you do not shutdown that old runtime, it will still keep >>>> running. But if you shutdown the execution plan from the client code, you >>>> should not encounter any issue. @Suho, please correct if my understanding >>>> is incorrect on this. >>>> >>>> @Lakini, if you are having two execution plans with different names and >>>> still it seems that one query is overriding the other, that is wrong. Can >>>> you share the execution plan syntax you are using for the two queries and >>>> also point to the code? Based on the scenario described above, it seems >>>> there is a conflict on the execution plan names or the output streams of >>>> the execution plans. >>>> >>>> Thanks, >>>> Lasantha >>>> >>>> On 25 August 2015 at 16:09, Srinath Perera <[email protected]> wrote: >>>> >>>>> Please point to your code. >>>>> >>>>> CEP team, please help. >>>>> >>>>> On Tue, Aug 25, 2015 at 4:00 PM, Lakini Senanayaka <[email protected]> >>>>> wrote: >>>>> >>>>>> Srinath,thank you for your prompt reply. >>>>>> >>>>>> My Client and Service run separately in 2 different processes.I have >>>>>> just developed 2 simple apps which send random data and I controlled it >>>>>> using a timer.I have set 2 different rules for the 2 apps.one client has >>>>>> a >>>>>> rule like notify when the value>50 and the second client has a rule like >>>>>> notify when the value>20.When running two clients in the same time ,the >>>>>> first client get notification for value>20,although it's rule is >>>>>> value>50. >>>>>> >>>>>> So the SiddhiManager has overrides the 1st client's query by second >>>>>> client's query. >>>>>> >>>>>> On Tue, Aug 25, 2015 at 3:36 PM, Srinath Perera <[email protected]> >>>>>> wrote: >>>>>> >>>>>>> Suho is Siddhi engine thread safe >>>>>>> 1. send events >>>>>>> 2. to change queries. >>>>>>> >>>>>>> Lakini answer depends on above. >>>>>>> >>>>>>> Could u explain how two clients override the same query? are they >>>>>>> running the same query? >>>>>>> >>>>>>> Thanks >>>>>>> Srinath >>>>>>> >>>>>>> On Tue, Aug 25, 2015 at 3:24 PM, Lakini Senanayaka <[email protected]> >>>>>>> wrote: >>>>>>> >>>>>>>> Hi Srinath, >>>>>>>> >>>>>>>> As an small introduction to my project,it is about EdgeAnalytics >>>>>>>> Service which is an android service and it does edge analytic using >>>>>>>> Siddhi >>>>>>>> queries. There are 2 types of clients for the service.I have developed >>>>>>>> Type >>>>>>>> 1 client which sends it's own data to analyse with user define >>>>>>>> streams,rule >>>>>>>> and a callback.I'm using AIDL interface method for the Client-Service >>>>>>>> connection. >>>>>>>> >>>>>>>> I have a copy of working project now.In here I used a single thread >>>>>>>> to develop service as you told me in the meeting ,where we discussed >>>>>>>> the >>>>>>>> Architecture of Edge Analytic Service.But in my application when we are >>>>>>>> running 2 or more client apps in the same time the siddhimanager in >>>>>>>> the >>>>>>>> service overrides the the 1st rule of the first running client with the >>>>>>>> rule of second client.(in here rule mean the Logic)So for first client >>>>>>>> it >>>>>>>> gives wrong results.So to overcome from that we have to use multi >>>>>>>> threading >>>>>>>> and I discussed this issue with Shan and he told me that this problem >>>>>>>> can >>>>>>>> be solve by using multi threading.So Could you please advice me >>>>>>>> how to overcome this issue,although you told me not to use >>>>>>>> multithreading. >>>>>>>> Suggestions would be appreciate. >>>>>>>> >>>>>>>> I have attached a documentation about Edge Analytic s Service. >>>>>>>> >>>>>>>> >>>>>>>> Thank you. >>>>>>>> -- >>>>>>>> *Intern-Engineering* >>>>>>>> Lakini S.Senanayaka >>>>>>>> Mobile: +94 712295444 >>>>>>>> Email: [email protected] >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> ============================ >>>>>>> Blog: http://srinathsview.blogspot.com twitter:@srinath_perera >>>>>>> Site: http://people.apache.org/~hemapani/ >>>>>>> Photos: http://www.flickr.com/photos/hemapani/ >>>>>>> Phone: 0772360902 >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> *Intern-Engineering* >>>>>> Lakini S.Senanayaka >>>>>> Mobile: +94 712295444 >>>>>> Email: [email protected] >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> ============================ >>>>> Blog: http://srinathsview.blogspot.com twitter:@srinath_perera >>>>> Site: http://people.apache.org/~hemapani/ >>>>> Photos: http://www.flickr.com/photos/hemapani/ >>>>> Phone: 0772360902 >>>>> >>>>> _______________________________________________ >>>>> Dev mailing list >>>>> [email protected] >>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>> >>>>> >>>> >>>> >>>> -- >>>> *Lasantha Fernando* >>>> Senior Software Engineer - Data Technologies Team >>>> WSO2 Inc. http://wso2.com >>>> >>>> email: [email protected] >>>> mobile: (+94) 71 5247551 >>>> >>> >>> >>> >>> -- >>> *Intern-Engineering* >>> Lakini S.Senanayaka >>> Mobile: +94 712295444 >>> Email: [email protected] >>> >> >> >> >> -- >> *Lasantha Fernando* >> Senior Software Engineer - Data Technologies Team >> WSO2 Inc. http://wso2.com >> >> email: [email protected] >> mobile: (+94) 71 5247551 >> > > > > -- > *Intern-Engineering* > Lakini S.Senanayaka > Mobile: +94 712295444 > Email: [email protected] > -- *Lasantha Fernando* Senior Software Engineer - Data Technologies Team WSO2 Inc. http://wso2.com email: [email protected] mobile: (+94) 71 5247551
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
