ddd
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package com.r11.tools;
|
||||
|
||||
import com.r11.tools.configuration.RetentionConfigurationProperties;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
|
||||
/**
|
||||
* It's generic Spring context starter. Move along...
|
||||
@@ -9,6 +11,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
* @author Rafał Żukowicz
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableConfigurationProperties(RetentionConfigurationProperties.class)
|
||||
public class KlausApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.r11.tools.configuration;
|
||||
|
||||
import ch.qos.logback.core.util.FixedDelay;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
||||
@EnableScheduling
|
||||
@EnableAsync
|
||||
@Configuration
|
||||
public class RetentionConfiguration {
|
||||
|
||||
@Async
|
||||
@Scheduled(fixedDelayString = "#{${retention.minutes-to-delete-message} * 60000}")
|
||||
public void deleteMessage(){
|
||||
System.out.println("Message deleting");
|
||||
}
|
||||
|
||||
@Async
|
||||
@Scheduled(fixedDelayString = "#{${retention.minutes-to-delete-history-record} * 60000}")
|
||||
public void deleteHistoryRecord(){
|
||||
System.out.println("History deleting");
|
||||
}
|
||||
|
||||
@Async
|
||||
@Scheduled(fixedDelayString = "#{${retention.minutes-to-delete-unused-message} * 60000}")
|
||||
public void deleteUnusedMessages(){
|
||||
System.out.println("Unused messages deleting");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.r11.tools.configuration;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.validation.constraints.Positive;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "retention")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RetentionConfigurationProperties {
|
||||
@Positive
|
||||
private Integer minutesToDeleteMessage;
|
||||
@Positive
|
||||
private Integer minutesToDeleteHistoryRecord;
|
||||
@Positive
|
||||
private Integer minutesToDeleteUnusedMessage;
|
||||
}
|
||||
@@ -19,6 +19,11 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
/**
|
||||
* Interceptor that gets needed data from HttpRequest, and saves it to history
|
||||
* @author Mikołaj Widła
|
||||
*/
|
||||
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class IncomingMockRequestInterceptor implements HandlerInterceptor {
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
#environment:
|
||||
server.port = 8097
|
||||
spring.redis.host=redis
|
||||
spring.redis.port=6379
|
||||
spring.application.name = klaus
|
||||
spring.mvc.view.suffix=.html
|
||||
logging.level.root=INFO
|
||||
logging.level.org.springframework.web=INFO
|
||||
logging.level.com.release11=INFO
|
||||
|
||||
#database:
|
||||
spring.redis.host=redis
|
||||
spring.redis.port=6379
|
||||
|
||||
#retention
|
||||
retention.minutes-to-delete-message=1
|
||||
retention.minutes-to-delete-history-record=2
|
||||
retention.minutes-to-delete-unused-message=3
|
||||
|
||||
Reference in New Issue
Block a user