Skip to content

Commit a7d6d34

Browse files
committed
chore: enhance documentation
Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
1 parent e31e6b8 commit a7d6d34

File tree

5 files changed

+164
-60
lines changed

5 files changed

+164
-60
lines changed

README.adoc

Lines changed: 136 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,52 +1470,158 @@ You can use either the Maven or Gradle dependencies:
14701470

14711471
=== Configuration
14721472

1473-
This API provides the ```RedisConfigurations``` class to programmatically establish the credentials.
1473+
This is an example using Redis's Key-Value API with MicroProfile Config.
14741474
Please note that you can establish properties using the https://microprofile.io/microprofile-config/[MicroProfile Config] specification.
14751475

1476-
[cols="Redis"]
1477-
|===
1478-
|Configuration property |Description
1476+
[source,properties]
1477+
----
1478+
jnosql.keyvalue.provider=org.eclipse.jnosql.databases.redis.communication.RedisConfiguration
1479+
jnosql.keyvalue.database=heroes
1480+
----
14791481

1480-
|`jnosql.redis.host`
1481-
|The database host
1482+
This API provides enum classes to programmatically establish the credentials as:
14821483

1483-
|`jnosql.redis.port`
1484-
|The database port
1484+
- link:README.adoc#_single_node_configuration[`RedisConfigurations`] for single node configuration
1485+
+
1486+
[source,properties]
1487+
----
1488+
# Single Node Configuration
14851489
1486-
|`jnosql.redis.timeout`
1487-
|The redis timeout, the default value 2000 on milliseconds
1490+
# by default the host is localhost
1491+
jnosql.redis.host=localhost
1492+
# by default the port is 6379
1493+
jnosql.redis.port=6379
1494+
# if you have user
1495+
jnosql.redis.user=youruser
1496+
# if you have password
1497+
jnosql.redis.password=yourpassword
1498+
----
14881499

1489-
|`jnosql.redis.password`
1490-
|The user's password
1500+
- link:README.adoc#_redis_sentinel_configuration[`RedisSentinelConfigurations`] for sentinel configuration
1501+
+
1502+
[source,properties]
1503+
----
1504+
# Sentinel Configuration
1505+
jnosql.redis.sentinel.hosts=host1:26379,host2:26379
1506+
1507+
jnosql.redis.sentinel.master.name=masterName
1508+
jnosql.redis.sentinel.master.user=masterUser
1509+
jnosql.redis.sentinel.master.password=masterPassword
1510+
#jnosql.redis.sentinel.master.ssl=false
1511+
#jnosql.redis.sentinel.master.timeout=2000
1512+
#jnosql.redis.sentinel.master.connection.timeout=2000
1513+
#jnosql.redis.sentinel.master.socket.timeout=2000
1514+
1515+
jnosql.redis.sentinel.slave.user=slaveUser
1516+
jnosql.redis.sentinel.slave.password=slavePassword
1517+
#jnosql.redis.sentinel.slave.ssl=false
1518+
#jnosql.redis.sentinel.slave.timeout=2000
1519+
#jnosql.redis.sentinel.slave.connection.timeout=2000
1520+
#jnosql.redis.sentinel.slave.socket.timeout=2000
1521+
----
1522+
1523+
- link:README.adoc#_redis_sentinel_configuration[`RedisClusterConfigurations`] for cluster configuration
1524+
+
1525+
[source,properties]
1526+
----
1527+
# Cluster Configuration
14911528
1492-
|`jnosql.redis.database`
1493-
|The redis database number, the default value is 0
1529+
jnosql.redis.cluster.hosts=host1:6379,host2:6379
1530+
jnosql.redis.cluster.user=clusterUser
1531+
jnosql.redis.cluster.password=clusterPassword
1532+
jnosql.redis.cluster.client.name=clusterClientName
1533+
jnosql.redis.cluster.max.attempts=5
1534+
jnosql.redis.cluster.max.total.retries.duration=10000
1535+
#jnosql.redis.cluster.ssl=false
1536+
#jnosql.redis.cluster.timeout=2000
1537+
#jnosql.redis.cluster.connection.timeout=2000
1538+
#jnosql.redis.cluster.socket.timeout=2000
1539+
----
14941540

1495-
|`jnosql.redis.client.name`
1496-
|The client's name
1541+
==== Single Node Configuration
1542+
1543+
This API provides the `RedisConfigurations` class to programmatically establish the credentials.
1544+
Please note that you can establish properties using the https://microprofile.io/microprofile-config/[MicroProfile Config] specification.
14971545

1498-
|`jnosql.redis.max.total`
1499-
|The value for the maxTotal configuration attribute for pools created with this configuration instance, the default value 1000.
1546+
[cols="2,2", options="header"]
1547+
|===
1548+
|Configuration property |Description
15001549

1501-
|`jnosql.redis.max.idle`
1502-
|The value for the maxIdle configuration attribute for pools created with this configuration instance, the default value 10.
1550+
|`jnosql.redis.host` |The database host
1551+
|`jnosql.redis.port` |The database port
1552+
|`jnosql.redis.timeout` |The redis timeout, the default value is 2000 milliseconds
1553+
|`jnosql.redis.password` |The password's credential
1554+
|`jnosql.redis.database` |The redis database number
1555+
|`jnosql.redis.client.name` |The cluster client's name. The default value is 0.
1556+
|`jnosql.redis.max.total` |The value for the maxTotal configuration attribute for pools created with this configuration instance. The default value is 1000.
1557+
|`jnosql.redis.max.idle` |The value for the maxIdle configuration attribute for pools created with this configuration instance. The default value is 10.
1558+
|`jnosql.redis.min.idle` |The value for the minIdle configuration attribute for pools created with this configuration instance. The default value is 1.
1559+
|`jnosql.redis.max.wait.millis` |The value for the maxWait configuration attribute for pools created with this configuration instance. The default value is 3000 milliseconds.
1560+
|`jnosql.redis.connection.timeout` |The connection timeout in milliseconds configuration attribute for the jedis client configuration created with this configuration instance.
1561+
|`jnosql.redis.socket.timeout` |The socket timeout in milliseconds configuration attribute for the jedis client configuration with this configuration instance.
1562+
|`jnosql.redis.user` |The user configuration attribute for the jedis client configuration with this configuration instance.
1563+
|`jnosql.redis.ssl` |The ssl configuration attribute for the jedis client configuration with this configuration instance. The default value is false.
1564+
|`jnosql.redis.protocol` |The protocol configuration attribute for the jedis client configuration with this configuration instance.
1565+
|`jnosql.redis.clientset.info.config.disabled` |The clientset info disabled configuration attribute for the jedis client configuration with this configuration instance. The default value is false.
1566+
|`jnosql.redis.clientset.info.config.libname.suffix` |The clientset info configuration libname suffix attribute for the jedis client configuration with this configuration instance.
1567+
|===
15031568

1504-
|`jnosql.redis.min.idle`
1505-
|The value for the minIdle configuration attribute for pools created with this configuration instance, the default value 1.
1569+
==== Redis Sentinel Configuration
15061570

1507-
|`jnosql.redis.max.wait.millis`
1508-
|The value for the maxWait configuration attribute for pools created with this configuration instance, the default value 3000.
1571+
This API provides the `RedisSentinelConfigurations` class to programmatically establish the credentials.
1572+
Please note that you can establish properties using the https://microprofile.io/microprofile-config/[MicroProfile Config] specification.
15091573

1574+
[cols="2,2", options="header"]
1575+
|===
1576+
|Configuration Property |Description
1577+
1578+
|`jnosql.redis.sentinel.hosts` |The value for the sentinel HOST:PORT (separated by comma) configuration attribute for the jedis client configuration with this configuration instance.
1579+
|`jnosql.redis.sentinel.master.name` |The value for the master name configuration attribute for the jedis client configuration with this configuration instance.
1580+
|`jnosql.redis.sentinel.master.client.name` |The master client's name, the default value is 0
1581+
|`jnosql.redis.sentinel.slave.client.name` |The slave client's name, the default value is 0
1582+
|`jnosql.redis.sentinel.master.timeout` |The master redis timeout, the default value is 2000 milliseconds
1583+
|`jnosql.redis.sentinel.slave.timeout` |The slave redis timeout, the default value is 2000 milliseconds
1584+
|`jnosql.redis.sentinel.master.connection.timeout` |The connection timeout in milliseconds configuration attribute for the master jedis client configuration created with this configuration instance.
1585+
|`jnosql.redis.sentinel.slave.connection.timeout` |The connection timeout in milliseconds configuration attribute for the slave jedis client configuration created with this configuration instance.
1586+
|`jnosql.redis.sentinel.master.socket.timeout` |The socket timeout in milliseconds configuration attribute for the master jedis client configuration with this configuration instance.
1587+
|`jnosql.redis.sentinel.slave.socket.timeout` |The socket timeout in milliseconds configuration attribute for the slave jedis client configuration with this configuration instance.
1588+
|`jnosql.redis.sentinel.master.user` |The user configuration attribute for the master jedis client configuration with this configuration instance.
1589+
|`jnosql.redis.sentinel.slave.user` |The user configuration attribute for the slave jedis client configuration with this configuration instance.
1590+
|`jnosql.redis.sentinel.master.password` |The password configuration attribute for the master jedis client configuration with this configuration instance.
1591+
|`jnosql.redis.sentinel.slave.password` |The password configuration attribute for the slave jedis client configuration with this configuration instance.
1592+
|`jnosql.redis.sentinel.master.ssl` |The ssl configuration attribute for the master jedis client configuration with this configuration instance. The default value is false.
1593+
|`jnosql.redis.sentinel.slave.ssl` |The ssl configuration attribute for the slave jedis client configuration with this configuration instance. The default value is false.
1594+
|`jnosql.redis.sentinel.master.protocol` |The protocol configuration attribute for the master jedis client configuration with this configuration instance.
1595+
|`jnosql.redis.sentinel.slave.protocol` |The protocol configuration attribute for the slave jedis client configuration with this configuration instance.
1596+
|`jnosql.redis.sentinel.master.clientset.info.config.disabled` |The clientset info disabled configuration attribute for the master jedis client configuration with this configuration instance. The default value is false.
1597+
|`jnosql.redis.sentinel.slave.clientset.info.config.disabled` |The clientset info disabled configuration attribute for the slave jedis client configuration with this configuration instance. The default value is false.
1598+
|`jnosql.redis.sentinel.master.clientset.info.config.libname.suffix` |The clientset info configuration libname suffix attribute for the master jedis client configuration with this configuration instance.
1599+
|`jnosql.redis.sentinel.slave.clientset.info.config.libname.suffix` |The clientset info configuration libname suffix attribute for the slave jedis client configuration with this configuration instance.
15101600
|===
15111601

1512-
This is an example using Redis's Key-Value API with MicroProfile Config.
1602+
==== Redis Cluster Configuration
15131603

1514-
[source,properties]
1515-
----
1516-
jnosql.keyvalue.provider=org.eclipse.jnosql.databases.redis.communication.RedisConfiguration
1517-
jnosql.keyvalue.database=heroes
1518-
----
1604+
This API provides the `RedisClusterConfigurations` class to programmatically establish the credentials.
1605+
Please note that you can establish properties using the https://microprofile.io/microprofile-config/[MicroProfile Config] specification.
1606+
1607+
[cols="2,2", options="header"]
1608+
|===
1609+
|Configuration Property |Description
1610+
1611+
|`jnosql.redis.cluster.hosts` |The value for the sentinel HOST:PORT (separated by comma) configuration attribute for the jedis client configuration with this configuration instance.
1612+
|`jnosql.redis.cluster.client.name` |The cluster client's name. The default value is 0.
1613+
|`jnosql.redis.cluster.timeout` |The cluster redis timeout, the default value is 2000 milliseconds
1614+
|`jnosql.redis.cluster.connection.timeout` |The connection timeout in milliseconds configuration attribute for the cluster jedis client configuration created with this configuration instance.
1615+
|`jnosql.redis.cluster.socket.timeout` |The socket timeout in milliseconds configuration attribute for the cluster jedis client configuration with this configuration instance.
1616+
|`jnosql.redis.cluster.user` |The user configuration attribute for the cluster jedis client configuration with this configuration instance.
1617+
|`jnosql.redis.cluster.password` |The password configuration attribute for the cluster jedis client configuration with this configuration instance.
1618+
|`jnosql.redis.cluster.ssl` |The ssl configuration attribute for the cluster jedis client configuration with this configuration instance. The default value is false.
1619+
|`jnosql.redis.cluster.protocol` |The protocol configuration attribute for the cluster jedis client configuration with this configuration instance.
1620+
|`jnosql.redis.cluster.clientset.info.config.disabled` |The clientset info disabled configuration attribute for the cluster jedis client configuration with this configuration instance. The default value is false.
1621+
|`jnosql.redis.cluster.clientset.info.config.libname.suffix` |The clientset info configuration libname suffix attribute for the cluster jedis client configuration with this configuration instance.
1622+
|`jnosql.redis.cluster.max.attempts` |The value for the max attempts configuration attribute for the cluster jedis client configuration with this configuration instance. Default is 5.
1623+
|`jnosql.redis.cluster.max.total.retries.duration` |The value for the max total retries configuration attribute for the cluster jedis client configuration with this configuration instance. Default is 10000 milliseconds.
1624+
|===
15191625

15201626
=== RedisBucketManagerFactory
15211627

jnosql-redis/src/main/java/org/eclipse/jnosql/databases/redis/communication/RedisClusterConfigurations.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929
public enum RedisClusterConfigurations implements Supplier<String> {
3030
/**
31-
* The value for the sentinel basic configuration attribute for the jedis client configuration with this configuration instance.
31+
* The key property that defines if the redis cluster configuration should be loaded
3232
*/
3333
CLUSTER("jnosql.redis.cluster"),
3434
/**
@@ -40,19 +40,19 @@ public enum RedisClusterConfigurations implements Supplier<String> {
4040
*/
4141
CLIENT_NAME("jnosql.redis.cluster.client.name"),
4242
/**
43-
* The cluster redis timeout. The default value is {@link Protocol#DEFAULT_TIMEOUT}
43+
* The cluster redis timeout, the default value is {@link redis.clients.jedis.Protocol#DEFAULT_TIMEOUT} on milliseconds
4444
*/
4545
TIMEOUT("jnosql.redis.cluster.timeout"),
4646
/**
4747
* The value for the connection timeout in milliseconds configuration attribute for the cluster jedis client configuration
4848
* created with this configuration instance.
49-
* The connection timeout on millis on {@link redis.clients.jedis.JedisClientConfig}, the default value is {@link Protocol#DEFAULT_TIMEOUT}
49+
* The connection timeout on millis on {@link redis.clients.jedis.JedisClientConfig}, the default value is {@link redis.clients.jedis.Protocol#DEFAULT_TIMEOUT}
5050
*/
5151
CONNECTION_TIMEOUT("jnosql.redis.cluster.connection.timeout"),
5252
/**
5353
* The value for the socket timeout in milliseconds configuration attribute for the cluster jedis client configuration with
5454
* this configuration instance.
55-
* The socket timeout on millis on {@link redis.clients.jedis.JedisClientConfig}, the default is {@link Protocol#DEFAULT_TIMEOUT}
55+
* The socket timeout on millis on {@link redis.clients.jedis.JedisClientConfig}, the default value is {@link redis.clients.jedis.Protocol#DEFAULT_TIMEOUT}
5656
*/
5757
SOCKET_TIMEOUT("jnosql.redis.cluster.socket.timeout"),
5858
/**
@@ -72,17 +72,20 @@ public enum RedisClusterConfigurations implements Supplier<String> {
7272
SSL("jnosql.redis.cluster.ssl"),
7373
/**
7474
* The value for the protocol configuration attribute for the cluster jedis client configuration with this configuration instance.
75-
* The protocol on {@link redis.clients.jedis.JedisClientConfig}
75+
* The ssl on {@link redis.clients.jedis.JedisClientConfig}. The default value is false.
76+
* The default value is not defined.
7677
*/
7778
REDIS_PROTOCOL("jnosql.redis.cluster.protocol"),
7879
/**
7980
* The value for the clientset info disabled configuration attribute for the cluster jedis client configuration with this configuration instance.
8081
* The clientset info disabled on {@link redis.clients.jedis.JedisClientConfig}
82+
* The default value is false.
8183
*/
8284
CLIENTSET_INFO_CONFIG_DISABLED("jnosql.redis.cluster.clientset.info.config.disabled"),
8385
/**
8486
* The value for the clientset info configuration libname suffix attribute for the cluster jedis client configuration with this configuration instance.
8587
* The clientset info libname suffix on {@link redis.clients.jedis.JedisClientConfig}
88+
* The default value is not defined.
8689
*/
8790
CLIENTSET_INFO_CONFIG_LIBNAME_SUFFIX("jnosql.redis.cluster.clientset.info.config.libname.suffix"),
8891

jnosql-redis/src/main/java/org/eclipse/jnosql/databases/redis/communication/RedisConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ public RedisBucketManagerFactory apply(Settings settings) {
6767

6868
if (settings.keySet()
6969
.stream()
70-
.anyMatch(s -> s.startsWith(RedisConfigurations.SENTINEL.get()))) {
70+
.anyMatch(s -> s.startsWith(RedisSentinelConfigurations.SENTINEL.get()))) {
7171
return applyForSentinel(settings);
7272
}
7373

7474
if (settings.keySet()
7575
.stream()
76-
.anyMatch(s -> s.startsWith(RedisConfigurations.CLUSTER.get()))) {
76+
.anyMatch(s -> s.startsWith(RedisClusterConfigurations.CLUSTER.get()))) {
7777
return applyForCluster(settings);
7878
}
7979

0 commit comments

Comments
 (0)