更新时间:2024-10-23 GMT+08:00
ShedLock
对接ShedLock。
import com.huawei.devspore.mas.Redis.core.MultiZoneClient; import com.huawei.devspore.mas.Redis.spring.boot.cache.DcsConnectionFactory; import net.javacrumbs.shedlock.core.LockProvider; import net.javacrumbs.shedlock.provider.Redis.spring.RedisLockProvider; import net.javacrumbs.shedlock.spring.annotation.EnableSchedulerLock; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; @Configuration @EnableScheduling @EnableSchedulerLock(defaultLockAtMostFor = "PT30S") public class ShedLockJdbcConfig { @Bean public DcsConnectionFactory dcsConnectionFactory(MultiZoneClient client) { return new DcsConnectionFactory(client); } @Bean public LockProvider lockProvider(DcsConnectionFactory connectionFactory) { return new RedisLockProvider(connectionFactory); } }
父主题: 客户各场景替换方案