简体   繁体   English

Siddhi我没有从聚合查询中得到任何响应

[英]Siddhi I don't get any response from aggregate query

I have a simple query like this: 我有一个简单的查询,像这样:

define stream myEventStream (userId string, price int);  
define stream outputStream (avgPrice double, userId string);  

@info(name = 'aQuery')  
from myEventStream#window.time(5000)  
select avg(price) as avgPrice, userId group by userId  
insert into outputStream;

When I add the query callback I don't get any response from 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 another 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. 我希望每5秒就能得到结果。 What am I missing here? 我在这里想念什么? Please help. 请帮忙。 Thank you. 谢谢。

Well the problem was that I've shut down the runtime right after the code which produces the event stream. 问题是我在生成事件流的代码之后立即关闭了运行时。 Nevertheless I was able to send messages to runtime although it was shut down already. 尽管如此,尽管它已经关闭,但我仍能够向运行时发送消息。 No exception. 没有例外。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Siddhi CEP:具有时间窗口的聚合函数不会从聚合中“删除”值 - Siddhi CEP: Aggregate functions with time window don't “remove” values from aggregation 我没有从Java获得DatagramPacket的响应 - I don't get response from DatagramPacket with Java 为什么我没有从这个简单的Java网络爬虫应用程序获得任何结果? - Why I don't get any results from this simple java web-crawler application? 我在java中调用一个我无法控制的方法。 如果我没有得到它的回应,我想要杀死它并继续前进 - I'm calling a method in java which I have no control of. If I don't get a response from it, I want to kill it and move on API 是否可以做后端工作但我没有得到回应? - Is it possible for an API to do backend work but I don't get the response? 值不会插入数据库,即使我没有任何错误 - Values don't get inserted into the DB, even tho I don't get any errors 我没有任何海拔高度数据(GPS Android) - I don't get any altitude data (GPS Android) 我不想从axboot记录一个jpa查询 - I don't want to log a jpa query from axboot 在TextView上没有任何输出 - Don't get any output on TextView 如何从 BigQuery 流式传输(查询)数据作为 Siddhi 应用程序中的源 - How to stream (query) data from BigQuery as source in a Siddhi App
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM