Skip to content

Commit

Permalink
Fjernet "read" tilgang til Kafka for ebms-provider
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksandrChmyrNAV committed Dec 16, 2024
1 parent 8f09840 commit 41ed359
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
2 changes: 1 addition & 1 deletion .nais/kafka/kafka-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ spec:
retentionHours: 168
segmentHours: 168
acl:
- access: readwrite
- access: write
application: ebms-provider
team: team-emottak
21 changes: 0 additions & 21 deletions ebms-provider/src/main/kotlin/no/nav/emottak/ebms/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,6 @@ fun Application.ebmsProviderModule() {
get("/") {
call.respondText("Hello, world!")
}
get("/kafkatest_read") {
log.debug("Kafka test read: start")

val consumer = kafkaClientObject.createConsumer()
val topic = getEnvVar("KAFKA_TOPIC_ACKNOWLEDGMENTS", "team-emottak.smtp.out.ebxml.signal")

consumer.subscribe(listOf(topic))

try {
val records = consumer.poll(Duration.ofMillis(10000)).onEach {
log.debug("Kafka test read: Message read successfully: ${it.value()}")
}
log.debug("Kafka test read: Messages read - ${records.count()}")
} catch (e: Exception) {
log.error("Kafka test read: Exception while reading messages from queue", e)
} finally {
consumer.unsubscribe()
consumer.close()
}
call.respondText("Kafka works!")
}
get("/kafkatest_write") {
log.debug("Kafka test write: start")

Expand Down

0 comments on commit 41ed359

Please sign in to comment.