Skip to content

Instantly share code, notes, and snippets.

package ch.post.it.paisa.houston.process.main;
import io.vertx.core.Vertx;
import io.vertx.redis.RedisClient;
import io.vertx.redis.RedisOptions;
public class OliVerticle {
public static void main(String[] args) throws Exception {
Vertx vertx = Vertx.vertx();
RedisOptions redisOptions = new RedisOptions()
.setHost("127.0.0.1")
.setPort(6389)
.setAuth("isarulez");
RedisClient redisClient = RedisClient.create(vertx, redisOptions);
while (true) {
System.out.println("Issue Redis command");
redisClient.info(infoResult -> {
String serverVersion = infoResult.result().getJsonObject("server").getString("redis_version");
if (infoResult.succeeded()) {
System.out.println("Yes " + serverVersion);
} else {
System.out.println("Oh no " + infoResult.cause());
}
});
Thread.sleep(500);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment