safe-scheduling-provider-redis

it's a simple way to use the native Spring Framework Scheduling into your spring-boot application keeping the tasks locked during the executions process avoiding multiples executions.

License

License

Categories

Categories

IDE Development Tools Redis Data Databases
GroupId

GroupId

io.github.nortthon
ArtifactId

ArtifactId

safe-scheduling-provider-redis
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

safe-scheduling-provider-redis
it's a simple way to use the native Spring Framework Scheduling into your spring-boot application keeping the tasks locked during the executions process avoiding multiples executions.

Download safe-scheduling-provider-redis

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.nortthon/safe-scheduling-provider-redis/ -->
<dependency>
    <groupId>io.github.nortthon</groupId>
    <artifactId>safe-scheduling-provider-redis</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.nortthon/safe-scheduling-provider-redis/
implementation 'io.github.nortthon:safe-scheduling-provider-redis:0.2.0'
// https://jarcasting.com/artifacts/io.github.nortthon/safe-scheduling-provider-redis/
implementation ("io.github.nortthon:safe-scheduling-provider-redis:0.2.0")
'io.github.nortthon:safe-scheduling-provider-redis:jar:0.2.0'
<dependency org="io.github.nortthon" name="safe-scheduling-provider-redis" rev="0.2.0">
  <artifact name="safe-scheduling-provider-redis" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.nortthon', module='safe-scheduling-provider-redis', version='0.2.0')
)
libraryDependencies += "io.github.nortthon" % "safe-scheduling-provider-redis" % "0.2.0"
[io.github.nortthon/safe-scheduling-provider-redis "0.2.0"]

Dependencies

compile (1)

Group / Artifact Type Version
io.github.nortthon : safe-scheduling-core jar 0.2.0

provided (3)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-data-redis jar 2.1.3.RELEASE
org.springframework : spring-context jar 5.1.4.RELEASE
org.projectlombok : lombok jar 1.18.4

test (2)

Group / Artifact Type Version
it.ozimov : embedded-redis jar 0.7.1
org.springframework.boot : spring-boot-starter-test jar 2.1.3.RELEASE

Project Modules

There are no modules declared in this project.

Safe Scheduling

License Actions Status Quality Gate Status Maintainability Rating Coverage

What is this?

it's a simple way to use the native Spring Framework Scheduling into your spring-boot application keeping the tasks locked during the executions process avoiding multiples executions.

TaskScheduler Bean

@Configuration
@EnableScheduling
public class SchedulerConfig {
    
    @Bean
    public TaskScheduler taskScheduler(final Provider provider) {
        final LockableTaskScheduler taskScheduler = new LockableTaskScheduler(provider);
        taskScheduler.setPoolSize(1); // Default == 1
        return taskScheduler;
    }
    
    //Provider Bean
}

Use like this

@Component
public class Class {
    @SafeScheduled(name = "scheduler-name", lockedFor = 4000L, cron = "*/5 * * * * *")
    public void execute() {
        //TODO
    }
}

MongoDB Provider

Dependences
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
    <groupId>io.github.nortthon</groupId>
    <artifactId>safe-scheduling-provider-mongodb</artifactId>
    <version>0.2.0</version>
</dependency>
Provider Bean
@Bean
public Provider provider(final MongoTemplate mongoTemplate) {
    new MongoProvider(mongoTemplate);
}

Redis Provider

Dependences
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
    <groupId>io.github.nortthon</groupId>
    <artifactId>safe-scheduling-provider-redis</artifactId>
    <version>0.2.0</version>
</dependency>
Provider Bean
@Bean
public Provider provider(final StringRedisTemplate redisTemplate) {
    new RedisProvider(redisTemplate);
}

Versions

Version
0.2.0