vertx-redis-client (3.9.1) RedisAPI.get not getting any response.

88 views
Skip to first unread message

Tuhin Subhra Mandal

unread,
Jun 29, 2020, 3:22:22 PM6/29/20
to vert.x
Hi I am using vertx-redis-client and creating a pool.

My requirement is to check for the key in redis. If it does not exist, need to prepare some key, value and push it to redis.

The way I am doing it is as follows:

When I make a call to check ping, or the get key call, the thread is blocked for a long time, and async handler does not return any result. I am able to see that connection is getting established.

----------------> WARNING: Thread Thread[vert.x-eventloop-thread-0,5,main]=Thread[vert.x-eventloop-thread-0,5,main] has been blocked for 4278 ms, time limit is 20 ms

Future<Redis> redisPoolFuture = RedisVertx.createRedisPool (vertx, config);


redisPoolFuture.onSuccess (pool -> {
RedisAPI redis = RedisAPI.api (pool);
pool.send (Request.cmd (Command.PING), pingHandler -> {
System.out.println ("========================> " + pingHandler.result ());
});
redis.get ("tuhin-key1", ah -> {
System.out.println ("------------------> " + ah.result ());
});
});



// Here is the method that generates redis pool

public static Future<Redis> createRedisPool(Vertx vertx, Config config) {

return Future.future (promise -> {
Redis redisPool = Redis.createClient (
vertx,
new RedisOptions ()
.setConnectionString ("redis://localhost:6379")
// allow at max 16 connections
.setMaxPoolSize (16)
// allow 32 connection requests to queue waiting
// for a connection to be available.
.setMaxWaitingHandlers (32));
promise.complete (redisPool);
});
}




Reply all
Reply to author
Forward
0 new messages