Commit 009ea359 authored by Hema Vishnu Pola [Microsoft]'s avatar Hema Vishnu Pola [Microsoft]
Browse files

Merge branch 'update-library' into 'master'

update logging library to latest, update core common library to add client option to rediscache construction

See merge request !50
parents 3672fc12 a753241c
Pipeline #42065 passed with stages
in 47 minutes and 57 seconds
package org.opengroup.osdu.partition.provider.azure.di;
import com.azure.security.keyvault.secrets.SecretClient;
import com.lambdaworks.redis.ClientOptions;
import com.lambdaworks.redis.SocketOptions;
import org.opengroup.osdu.azure.KeyVaultFacade;
import org.opengroup.osdu.core.common.cache.RedisCache;
import org.opengroup.osdu.partition.model.PartitionInfo;
......@@ -11,6 +13,7 @@ import org.springframework.context.annotation.Configuration;
import javax.inject.Named;
import java.util.List;
import java.util.concurrent.TimeUnit;
@Configuration
public class RedisConfig {
......@@ -40,14 +43,23 @@ public class RedisConfig {
@Value("${redis.database}")
private int database;
@Value("${redis.connection.timeout}")
private long timeout;
@Bean
public RedisCache<String, PartitionInfo> partitionServiceCache(@Named("REDIS_HOST") String host, @Named("REDIS_PASSWORD") String password) {
return new RedisCache<>(host, port, password, expiration, database, String.class, PartitionInfo.class);
ClientOptions clientOptions = ClientOptions.builder()
.socketOptions(SocketOptions.builder().connectTimeout(timeout, TimeUnit.SECONDS).build())
.build();
return new RedisCache<>(host, port, password, expiration, database, clientOptions, String.class, PartitionInfo.class);
}
@Bean
public RedisCache<String, List<String>> partitionListCache(@Named("REDIS_HOST") String host, @Named("REDIS_PASSWORD") String password) {
return new RedisCache(host, port, password, expiration, database, String.class, List.class);
ClientOptions clientOptions = ClientOptions.builder()
.socketOptions(SocketOptions.builder().connectTimeout(timeout, TimeUnit.SECONDS).build())
.build();
return new RedisCache(host, port, password, expiration, database, clientOptions, String.class, List.class);
}
}
......@@ -65,14 +77,23 @@ public class RedisConfig {
@Value("${redis.database}")
private int database;
@Value("${redis.connection.timeout}")
private long timeout;
@Bean
public RedisCache<String, PartitionInfo> partitionServiceCache(@Named("REDIS_HOST") String host) {
return new RedisCache<>(host, port, expiration, database, String.class, PartitionInfo.class);
ClientOptions clientOptions = ClientOptions.builder()
.socketOptions(SocketOptions.builder().connectTimeout(timeout, TimeUnit.SECONDS).build())
.build();
return new RedisCache<>(host, port, expiration, database, clientOptions, String.class, PartitionInfo.class);
}
@Bean
public RedisCache<String, List<String>> partitionListCache(@Named("REDIS_HOST") String host) {
return new RedisCache(host, port, expiration, database, String.class, List.class);
ClientOptions clientOptions = ClientOptions.builder()
.socketOptions(SocketOptions.builder().connectTimeout(timeout, TimeUnit.SECONDS).build())
.build();
return new RedisCache(host, port, expiration, database, clientOptions, String.class, List.class);
}
}
......
......@@ -4,11 +4,11 @@ logging.level.org.springframework.web=${partition_spring_logging_level:INFO}
JAVA_OPTS=-Dserver.port=80
server.port=8080
springfox.documentation.swagger.v2.path=/api-docs
PARTITION_API=
#logging configuration
logging.transaction.enabled=true
logging.slf4jlogger.enabled=true
logging.mdccontext.enabled=true
# AAD properties
azure.activedirectory.app-resource-id=${aad_client_id}
......@@ -33,4 +33,9 @@ cache.maxSize=1000
redis.port=6380
redis.expiration=3600
redis.ssl.enabled=true
redis.connection.timeout=15
redis.database=${REDIS_DATABASE}
azure.cryptography.enabled=false
azure.eventgrid.topic.enabled=false
azure.eventgrid.manager.enabled=false
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment