-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #338 from bcgov/grad-release
Grad release 1.22
- Loading branch information
Showing
25 changed files
with
218 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 31 additions & 31 deletions
62
api/src/main/java/ca/bc/gov/educ/api/trax/config/RedisConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,55 @@ | ||
package ca.bc.gov.educ.api.trax.config; | ||
|
||
import ca.bc.gov.educ.api.trax.util.EducGradTraxApiConstants; | ||
import org.apache.commons.pool2.impl.GenericObjectPoolConfig; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.data.redis.connection.RedisClusterConfiguration; | ||
import org.springframework.data.redis.connection.RedisClusterNode; | ||
import org.springframework.data.redis.connection.RedisNode; | ||
import org.springframework.data.redis.connection.RedisStandaloneConfiguration; | ||
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; | ||
import org.springframework.data.redis.core.RedisTemplate; | ||
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories; | ||
import org.springframework.data.redis.serializer.GenericToStringSerializer; | ||
import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer; | ||
import org.springframework.data.redis.serializer.StringRedisSerializer; | ||
import redis.clients.jedis.Jedis; | ||
import redis.clients.jedis.HostAndPort; | ||
import redis.clients.jedis.JedisCluster; | ||
|
||
import java.time.Duration; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
@Configuration | ||
@EnableRedisRepositories("ca.bc.gov.educ.api.trax.repository.redis") | ||
public class RedisConfig { | ||
@Autowired | ||
private EducGradTraxApiConstants constants; | ||
|
||
@Bean | ||
public JedisConnectionFactory jedisConnectionFactory() { | ||
RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration(); | ||
redisStandaloneConfiguration.setHostName(constants.getRedisUrl()); | ||
redisStandaloneConfiguration.setPort(Integer.parseInt(constants.getRedisPort())); | ||
redisStandaloneConfiguration.setPassword(constants.getRedisSecret()); | ||
|
||
//Cluster Configuration | ||
RedisClusterConfiguration redisClusterConfiguration = new RedisClusterConfiguration(); | ||
RedisNode node0 = new RedisNode(constants.getRedisUrl(), Integer.parseInt(constants.getRedisPort())); | ||
redisClusterConfiguration.addClusterNode(node0); | ||
|
||
RedisClusterNode rcn = new RedisClusterNode(constants.getRedisUrl(), Integer.parseInt(constants.getRedisPort())); | ||
|
||
return new JedisConnectionFactory(redisStandaloneConfiguration); | ||
redisClusterConfiguration.addClusterNode(new RedisClusterNode( | ||
constants.getRedisUrl(), | ||
Integer.parseInt(constants.getRedisPort()))); | ||
redisClusterConfiguration.setPassword(constants.getRedisSecret()); | ||
return new JedisConnectionFactory(redisClusterConfiguration); | ||
} | ||
|
||
@Bean | ||
public RedisTemplate<String, Object> redisTemplate() { | ||
final RedisTemplate<String, Object> template = new RedisTemplate<>(); | ||
template.setConnectionFactory(jedisConnectionFactory()); | ||
template.setKeySerializer(new StringRedisSerializer()); | ||
template.setValueSerializer(new GenericToStringSerializer<>(Object.class)); | ||
template.setHashKeySerializer(new JdkSerializationRedisSerializer()); | ||
template.setHashValueSerializer(new JdkSerializationRedisSerializer()); | ||
template.setEnableTransactionSupport(true); | ||
template.afterPropertiesSet(); | ||
|
||
return template; | ||
public JedisCluster jedisCluster() { | ||
Set<HostAndPort> jedisClusterNodes = new HashSet<>(); | ||
jedisClusterNodes.add( | ||
new HostAndPort(constants.getRedisUrl(), | ||
Integer.parseInt(constants.getRedisPort()))); | ||
|
||
GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig(); | ||
poolConfig.setMaxTotal(8); | ||
poolConfig.setMaxIdle(8); | ||
poolConfig.setMinIdle(0); | ||
poolConfig.setBlockWhenExhausted(true); | ||
poolConfig.setMaxWait(Duration.ofSeconds(1)); | ||
poolConfig.setTestWhileIdle(true); | ||
poolConfig.setTimeBetweenEvictionRuns(Duration.ofSeconds(1)); | ||
|
||
return new JedisCluster(jedisClusterNodes, 5000, 5000, 3, | ||
constants.getRedisUser(), constants.getRedisSecret(), | ||
"educ-grad-trax-api", poolConfig); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
api/src/main/resources/db/migration/1.0/V1.0.28__DDL-CREATE_TABLE-EVENT_HISTORY.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
CREATE TABLE "EVENT_HISTORY" | ||
( "EVENT_HISTORY_ID" RAW(16) DEFAULT SYS_GUID() NOT NULL ENABLE, | ||
"EVENT_ID" RAW(16) NOT NULL ENABLE, | ||
"ACKNOWLEDGE_FLAG" VARCHAR2(1) NOT NULL ENABLE, | ||
"CREATE_USER" VARCHAR2(32) DEFAULT USER NOT NULL ENABLE, | ||
"CREATE_DATE" DATE DEFAULT SYSTIMESTAMP NOT NULL ENABLE, | ||
"UPDATE_USER" VARCHAR2(32) DEFAULT USER NOT NULL ENABLE, | ||
"UPDATE_DATE" DATE DEFAULT SYSTIMESTAMP NOT NULL ENABLE, | ||
|
||
CONSTRAINT "EVENT_HISTORY_ID_PK" PRIMARY KEY ("EVENT_HISTORY_ID") | ||
USING INDEX TABLESPACE "API_GRAD_IDX" ENABLE | ||
) SEGMENT CREATION IMMEDIATE | ||
NOCOMPRESS LOGGING | ||
TABLESPACE "API_GRAD_DATA" NO INMEMORY ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.