Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f06abd2838 | ||
|
|
f0297f2d2c | ||
|
|
ec23bd4d32 | ||
|
|
bab1892673 | ||
|
|
247fe83caa | ||
|
|
5fe6165373 | ||
|
|
64a8f17e6e |
-41
@@ -1,41 +0,0 @@
|
|||||||
package de.twomartens.wahlrecht.service
|
|
||||||
|
|
||||||
import mu.KotlinLogging
|
|
||||||
import org.apache.logging.log4j.message.StringMapMessage
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier
|
|
||||||
import org.springframework.cloud.context.refresh.ContextRefresher
|
|
||||||
import org.springframework.scheduling.annotation.Scheduled
|
|
||||||
import org.springframework.stereotype.Service
|
|
||||||
import java.util.concurrent.TimeUnit
|
|
||||||
|
|
||||||
/**
|
|
||||||
* automatically reloads application*.yaml. reload can also be triggered manually by doing a post
|
|
||||||
* request on http://localhost:12001/actuator/refresh
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
class PropertyReloadService(@Qualifier("configDataContextRefresher") private val contextRefresher: ContextRefresher) {
|
|
||||||
@Scheduled(
|
|
||||||
fixedDelay = REFRESH_SECONDS.toLong(),
|
|
||||||
initialDelay = REFRESH_SECONDS.toLong(),
|
|
||||||
timeUnit = TimeUnit.SECONDS
|
|
||||||
)
|
|
||||||
fun refresh() {
|
|
||||||
val properties = contextRefresher.refresh()
|
|
||||||
if (properties.isNotEmpty()) {
|
|
||||||
log.info(
|
|
||||||
StringMapMessage()
|
|
||||||
.with(PARAM_MESSAGE, "properties changed")
|
|
||||||
.with(PARAM_PROPERTIES, properties.joinToString("\n"))
|
|
||||||
.asString()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
const val REFRESH_SECONDS = 60
|
|
||||||
const val PARAM_MESSAGE = "message"
|
|
||||||
const val PARAM_PROPERTIES = "labels.properties"
|
|
||||||
|
|
||||||
private val log = KotlinLogging.logger {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -28,6 +28,10 @@ spring:
|
|||||||
name: wahlrecht
|
name: wahlrecht
|
||||||
main:
|
main:
|
||||||
banner-mode: off
|
banner-mode: off
|
||||||
|
kafka:
|
||||||
|
bootstrap-servers:
|
||||||
|
- localhost:9092
|
||||||
|
- kafka:9092
|
||||||
profiles:
|
profiles:
|
||||||
default: dev
|
default: dev
|
||||||
data.mongodb:
|
data.mongodb:
|
||||||
@@ -38,6 +42,8 @@ spring:
|
|||||||
resourceserver:
|
resourceserver:
|
||||||
jwt:
|
jwt:
|
||||||
jwk-set-uri: https://id.2martens.de/realms/2martens/protocol/openid-connect/certs
|
jwk-set-uri: https://id.2martens.de/realms/2martens/protocol/openid-connect/certs
|
||||||
|
application:
|
||||||
|
name: wahlrecht
|
||||||
|
|
||||||
springdoc:
|
springdoc:
|
||||||
swagger-ui:
|
swagger-ui:
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
de.twomartens.wahlrecht:
|
de.twomartens.wahlrecht:
|
||||||
greeting: "Moin %s, you are great"
|
greeting: "Moin %s, you are prod"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
de.twomartens.wahlrecht:
|
de.twomartens.wahlrecht:
|
||||||
defaultTimeZone: Europe/Berlin
|
defaultTimeZone: Europe/Berlin
|
||||||
greeting: "Hello %s"
|
greeting: "Hello %s, on millenium"
|
||||||
statusprobe:
|
statusprobe:
|
||||||
scheduleDuration: 60
|
scheduleDuration: 60
|
||||||
maxKafkaFailureDuration: 5
|
maxKafkaFailureDuration: 5
|
||||||
|
|||||||
Reference in New Issue
Block a user