io.quarkus.redis.client.runtime.RedisClientRecorder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-redis-client Show documentation
Show all versions of quarkus-redis-client Show documentation
Connect to Redis in either imperative or reactive style
package io.quarkus.redis.client.runtime;
import java.util.function.Supplier;
import io.quarkus.arc.Arc;
import io.quarkus.redis.client.RedisClient;
import io.quarkus.redis.client.reactive.ReactiveRedisClient;
import io.quarkus.runtime.annotations.Recorder;
import io.vertx.redis.client.Redis;
import io.vertx.redis.client.RedisAPI;
@Recorder
public class RedisClientRecorder {
public Supplier redisClientSupplier(String clientName) {
return new Supplier() {
@Override
public RedisClient get() {
RedisAPIContainer redisAPIContainer = getRedisAPIContainer(clientName);
return redisAPIContainer.getRedisClient();
}
};
}
public Supplier reactiveRedisClientSupplier(String clientName) {
return new Supplier() {
@Override
public ReactiveRedisClient get() {
RedisAPIContainer redisAPIContainer = getRedisAPIContainer(clientName);
return redisAPIContainer.getReactiveClient();
}
};
}
public Supplier mutinyRedisSupplier(String clientName) {
return new Supplier() {
@Override
public MutinyRedis get() {
RedisAPIContainer redisAPIContainer = getRedisAPIContainer(clientName);
return redisAPIContainer.getMutinyRedis();
}
};
}
public Supplier mutinyRedisAPISupplier(String clientName) {
return new Supplier() {
@Override
public MutinyRedisAPI get() {
RedisAPIContainer redisApiContainer = getRedisAPIContainer(clientName);
return redisApiContainer.getMutinyRedisAPI();
}
};
}
public Supplier redisAPISupplier(String clientName) {
return new Supplier() {
@Override
public RedisAPI get() {
RedisAPIContainer redisAPIContainer = getRedisAPIContainer(clientName);
return redisAPIContainer.getRedisAPI();
}
};
}
public Supplier redisSupplier(String clientName) {
return new Supplier() {
@Override
public Redis get() {
RedisAPIContainer redisAPIContainer = getRedisAPIContainer(clientName);
return redisAPIContainer.getRedis();
}
};
}
private RedisAPIContainer getRedisAPIContainer(String clientName) {
RedisAPIProducer redisAPIProducer = Arc.container().instance(RedisAPIProducer.class).get();
return redisAPIProducer.getRedisAPIContainer(clientName);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy