I want to use tdengine's subscribe function to subscribe an class of equipments' data which in fact is a super table. I Just follow the demo in their offical website. Since I want resume consume,the data I hasn't consumed. The Code is like bellow:
//CREATE SUBSCRIBE
TSDBSubscribe sub = ((TSDBConnection)conn).subscribe("topic", "select * from meters", false);
//CONSUME DATA
int total = 0;
while(true) {
TSDBResultSet rs = sub.consume();
int count = 0;
while(rs.next()) {
count++;
}
total += count;
System.out.printf("%d rows consumed, total %d\n", count, total);
Thread.sleep(1000);
}
//CLOSE SUBSCRIBE
sub.close(true);
//RELEASE RESOURCE
resultSet.close();
stmt.close();
conn.close();
This code is just the same as their website's demo code, but it didn't performance like their descriptions. I set the "restart = false" , it still consume from the beginning. i wish someone can help find out what's the wrong with this?