io.quarkus.redis.runtime.client.config.RedisConfig 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.runtime.client.config;
import java.util.Map;
import io.quarkus.runtime.annotations.ConfigDocMapKey;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithParentName;
@ConfigMapping(prefix = "quarkus.redis")
@ConfigRoot(phase = ConfigPhase.RUN_TIME)
public interface RedisConfig {
public final static String REDIS_CONFIG_ROOT_NAME = "redis";
public final static String HOSTS_CONFIG_NAME = "hosts";
public static final String DEFAULT_CLIENT_NAME = "";
/**
* The default redis client
*/
@WithParentName
RedisClientConfig defaultRedisClient();
/**
* Configures additional (named) Redis clients.
*
* Each client has a unique name which must be identified to select the right client.
* For example:
*
*
*
* quarkus.redis.client1.hosts = redis://localhost:6379
* quarkus.redis.client2.hosts = redis://localhost:6380
*
*
* And then use the {@link io.quarkus.redis.client.RedisClientName} annotation to select the
* {@link io.vertx.mutiny.redis.client.Redis},
* {@link io.vertx.redis.client.Redis}, {@link io.vertx.mutiny.redis.client.RedisAPI} and
* {@link io.vertx.redis.client.RedisAPI} beans.
*
*
*
* {
* @code
* @RedisClientName("client1")
* @Inject
* RedisAPI redis;
* }
*
*/
@WithParentName
@ConfigDocMapKey("redis-client-name")
Map namedRedisClients();
static boolean isDefaultClient(String name) {
return DEFAULT_CLIENT_NAME.equalsIgnoreCase(name);
}
static String propertyKey(String name, String radical) {
String prefix = DEFAULT_CLIENT_NAME.equals(name)
? "quarkus.redis."
: "quarkus.redis.\"" + name + "\".";
return prefix + radical;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy