Browse Source

redis 断后重连

master
liwenxuan 2 weeks ago
parent
commit
9186a022a8
  1. 9
      pom.xml
  2. 2
      src/main/java/com/hxgk/lowcode/LowcodeApplication.java
  3. 10
      src/main/java/com/hxgk/lowcode/service/impl/HrServiceImpl.java

9
pom.xml

@ -141,6 +141,15 @@
<version>3.3.3</version>
</dependency>
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</dependency>
</dependencies>

2
src/main/java/com/hxgk/lowcode/LowcodeApplication.java

@ -2,8 +2,10 @@ package com.hxgk.lowcode;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.retry.annotation.EnableRetry;
@SpringBootApplication
@EnableRetry
public class LowcodeApplication {
public static void main(String[] args) {

10
src/main/java/com/hxgk/lowcode/service/impl/HrServiceImpl.java

@ -8,7 +8,12 @@ import com.hxgk.lowcode.model.entity.OrgContType;
import com.hxgk.lowcode.service.HrService;
import com.hxgk.lowcode.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.RedisConnectionFailureException;
import org.springframework.data.redis.RedisSystemException;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Recover;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@ -96,6 +101,11 @@ public class HrServiceImpl implements HrService {
return gGWsIdList;
}
//低代码穿梭框组织人员树
@Retryable(
value = {RedisConnectionFailureException.class, RedisSystemException.class},
maxAttempts = 3,
backoff = @Backoff(delay = 100, multiplier = 2)
)
@Override
public Tree getOrgAndManTree() {

Loading…
Cancel
Save