Kraken Log DB Client
Sample Code
Log Query Tutorial
public static void main(String[] args) throws RpcException, InterruptedException {
final LogDbClient client = new LogDbClient("test-guid");
try {
client.connect(new InetSocketAddress(7139), "1234");
LogQueryStatus q = client.createQuery("table test");
q.addCallback(new LogQueryCallback() {
@Override
public void onPageLoaded(int queryId) {
}
@Override
public void onEof(int queryId) {
try {
LogQueryResult r = client.getResult(queryId, 0, 10);
System.out.println("total " + r.getTotalCount());
Iterator<Object> it = r.getResult();
while (it.hasNext()) {
@SuppressWarnings("unchecked")
Map<String, Object> m = (Map<String, Object>) it.next();
System.out.println(m.get("_id") + ", " + m.get("line"));
}
client.removeQuery(queryId);
} catch (Exception e) {
e.printStackTrace();
}
}
});
System.out.println(q);
client.startQuery(q.getId(), 0, 10, 5);
client.waitFor(q.getId(), 5000);
} finally {
client.close();
}
}