java - Siddhi I don't get any response from aggregate query -
i have simple query this:
define stream myeventstream (userid string, price int); define stream outputstream (avgprice double, userid string); @info(name = 'aquery') myeventstream#window.time(5000) select avg(price) avgprice, userid group userid insert outputstream;
when add query callback don't response it.
runtime.addcallback("aquery", new querycallback() { @override public void receive(long timestamp, event[] inevents, event[] removeevents) { eventprinter.print(timestamp, inevents, removeevents); } });
i'm producing messages in thread:
final atomicinteger counter = new atomicinteger(0); final random rnd = new random(system.currenttimemillis()); executorservice executor = executors.newsinglethreadexecutor(); executor.submit(() -> { while (counter.getandincrement() < 100) { try { handler.send(new object[]{"user1", rnd.nextint(100)}); handler.send(new object[]{"user2", rnd.nextint(100)}); handler.send(new object[]{"user3", rnd.nextint(100)}); system.out.println("sent: " + counter.get()); thread.sleep(1000); } catch (interruptedexception e) { thread.currentthread().interrupt(); throw new runtimeexception(e); } } });
i'm expecting result each 5 seconds. missing here? please help. thank you.
well problem i've shut down runtime right after code produces event stream. nevertheless able send messages runtime although shut down already. no exception.
Comments
Post a Comment