Comments (5)
官方这个问题么有答复?
from tdengine.
收到 我们看下
from tdengine.
消息订阅的应用场景一般是要一直订阅的,当订阅的 topic 对应的表如果有新插入数据,都会poll到消息。
你如果想订阅到一条消息就退出循环,可以这么改:
while (time > 0) 改成 while (true)
在if (!obj.isEmpty()){
....
//增加一行
break;
}
from tdengine.
消息订阅的应用场景一般是要一直订阅的,当订阅的 topic 对应的表如果有新插入数据,都会poll到消息。
你如果想订阅到一条消息就退出循环,可以这么改: while (time > 0) 改成 while (true)
在if (!obj.isEmpty()){ .... //增加一行 break; }
谢谢,consumer.poll(Duration.ofMillis(100)),这里的poll周期是毫秒级,而且非阻塞,即使没数据线程也继续跑,poll的结果是null,外面必须套个while(true)。
通常iot设备上报数据的周期很长,一直consumer.poll,太浪费cpu,所以我整了个定时器,周期到的时候再new 一个consumer去poll,但是不能确定第几次能得到数据。
https://www.taosdata.com/tdengine-engineering/1277.html
c++的这段代码,红框中是得不到就break,但是对照我最上面的问题,有可能第一次就是得不到,而是第5次才得到,这样第一次break就有问题了。
from tdengine.
你开始的例子是用的java连接器,因此我给你的答复也是基于java连接器
判断条件是if (!obj.isEmpty()) 就是拿到数据了,此时可以break的
播客的时间比较早了,你可以参考官网代码样例,比较新
from tdengine.
Related Issues (20)
- Caused by: java.lang.UnsatisfiedLinkError: no taos in java.library.path HOT 2
- Cannot write the same stable as other stream HOT 1
- ODBC connection question HOT 1
- 关于查询问题 HOT 2
- interval()函数 + SPREAD()函数查询差值时,interval()参数不一样,计算策略不一致!该问题已经在微信群跟你们官方人员解释确认过! HOT 2
- 如何处理需要更新的字段? HOT 1
- docker容器安装,运行一段时间会重启日志如下 HOT 1
- docker容器安装,运行一段时间会重启日志如下 HOT 1
- 只是使用dbeaver查看数据库表出的这个问题,使用Java能够正常连接并使用
- PERCENTILE函数导致内存异常增加
- order by ts desc查询结果异常
- 使用mybatisPlus整合TDengine,连接方式可以使用REST 连接嘛,我看示例程序用的是原生连接方式。 HOT 1
- 查询时保留两位小数 HOT 1
- Question: how to create a stream to load data into super table with tags
- Questions: how to delete dnode ,the dnode node of tdengine is not starting properly HOT 1
- 文档流式计算部分有个单词错误 HOT 1
- mqtt通过restful保存数据, 部分数据丢失 HOT 2
- REDISTRIBUTE 具体是什么意思
- Write speed drops by 10x after a few million row inserts unless database is restarted or flushed HOT 3
- java.sql.SQLException: JNI ERROR (0x2354): Conn is broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tdengine.