mirror of
https://github.com/Dannecron/spring-boot-demo.git
synced 2025-12-26 00:32:34 +03:00
move consumers to new sub-project
This commit is contained in:
@@ -4,7 +4,10 @@ version = "single-version"
|
||||
dependencies {
|
||||
implementation(project(":db"))
|
||||
|
||||
implementation(rootProject.libs.spring.boot.starter.actuator)
|
||||
implementation(rootProject.libs.spring.boot.starter.jdbc)
|
||||
implementation(rootProject.libs.spring.boot.starter.validation)
|
||||
implementation(rootProject.libs.json.schema.validator)
|
||||
|
||||
testImplementation(rootProject.libs.spring.boot.starter.actuatorAutoconfigure)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.github.dannecron.demo.core.services.metrics
|
||||
|
||||
interface MetricsSender {
|
||||
fun incrementConsumerCityCreate()
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.github.dannecron.demo.core.services.metrics
|
||||
|
||||
import io.micrometer.core.instrument.Counter
|
||||
import io.micrometer.core.instrument.MeterRegistry
|
||||
import org.springframework.stereotype.Service
|
||||
|
||||
@Service
|
||||
class MetricsSenderImpl(
|
||||
metricRegistry: MeterRegistry,
|
||||
) : MetricsSender {
|
||||
private val consumerCityCreateCounter = Counter.builder("kafka_consumer_city_create")
|
||||
.description("consumed created city event")
|
||||
.register(metricRegistry)
|
||||
|
||||
override fun incrementConsumerCityCreate() {
|
||||
consumerCityCreateCounter.increment()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user