Skip to content

Commit

Permalink
Merge pull request #23806 from VanillaSpoon/DocumentRedisHostProvider
Browse files Browse the repository at this point in the history
Add redis host provider documentation.
  • Loading branch information
machi1990 authored Feb 18, 2022
2 parents 3493e06 + 182ac87 commit d9d10e9
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/src/main/asciidoc/redis.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,35 @@ RedisClient redisClient2;
ReactiveRedisClient reactiveClient2;
----

=== Providing Redis Hosts Programmatically

The `RedisHostsProvider` programmatically provides redis hosts. This allows for configuration of properties like redis connection password coming from other sources.

[NOTE]
====
This is useful as it removes the need to store sensitive data in application.properties.
====

[source,java,indent=0]
----
@ApplicationScoped
@Named("hosts-provider") // the name of the host provider
public class ExampleRedisHostProvider implements RedisHostsProvider {
@Override
public Set<URI> getHosts() {
// do stuff to get the host
String host = "redis://localhost:6379/3"
return Collections.singleton(URI.create(host));
}
}
----

The host provider can be used to configure the redis client like shown below
[source,properties,indent=0]
----
quarkus.redis.hosts-provider-name=hosts-provider
----

=== Creating Clients Programmatically

The `RedisClient` and `ReactiveRedisClient` provide factory methods to create clients programmatically.
Expand Down

0 comments on commit d9d10e9

Please sign in to comment.