I tried to make a CEP to run an event every 30 minutes. But I don't know how to do that, so I ask.
I looked for the type of cep and tried using esper as I thought fit.
Main Site : http://www.espertech.com/
instruction : http://www.espertech.com/esper/esper-documentation/
Reference Site : http://sungsoo.github.io/2014/01/02/overview-of-esper.html/
github : https://github.com/not-for-me/EsperStudyProject ,
https://github.com/espertechinc/esper
epl Test Site : http://esper-epl-tryout.appspot.com/epltryout/mainform.html
then I try it. But How can I use it???
public void EesperExample2(UserInfoDto udto) {
Configuration config = new Configuration();
config.addEventType("SearchYoutubeVo", SearchYoutubeVo.class.getName());
EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(config);
String epl = "select * , count(*) from SearchYoutubeVo.win:time(5 minutes)";
List<SearchYoutubeVo> vo;
EPStatement statement = epService.getEPAdministrator().createEPL(epl);
ExampleListener example = new ExampleListener();
statement.addListener(example);
int EventCreateNum = 5;
//for(int i = 0; i < EventCreateNum; i++ ){
try {
vo = youtubeSearchService.searchYoutube(udto);
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); }
//}
}
public class ExampleListener implements UpdateListener {
public void update(EventBean[] newEvents, EventBean[] oldEvents) {
EventBean event = newEvents[0];
System.out.println("Avg Rating of NFM = " + event.get("viewCount") + " Total Count: " + event.get("videoId"));
System.out.println(event.get("count(*)"));
}
}
'vo = youtubeSearchService.searchYoutube (udto);' Enter a youtube keyword.
'UserInfoDto udto' does not have user information.
YoutubeSearchService.searchYoutube (udto); Data allows you to get data in 5 minute intervals.
Comments
Post a Comment