Due to a scheduled upgrade to version 14.10, GitLab will be unavailabe on Monday 30.05., from 19:00 until 20:00.

Commit 16c6fddf authored by Thomas Bernhart's avatar Thomas Bernhart
Browse files

Add logging to Consumer

parent b964e3ee
Pipeline #22040 passed with stages
in 4 minutes and 22 seconds
......@@ -22,15 +22,19 @@ import java.time.Duration
import java.util.Properties
import org.apache.kafka.clients.consumer.ConsumerRecords
import org.apache.kafka.clients.consumer.KafkaConsumer
import org.apache.logging.log4j.LogManager
import org.apache.logging.log4j.Logger
class Consumer(props: Properties, topic: String) : Closeable {
private val instance = KafkaConsumer<String, String>(props)
private val log: Logger = LogManager.getLogger("FedoraIngestConsumer")
init {
instance.subscribe(listOf(topic))
}
fun fetchRecords(): ConsumerRecords<String, String> {
log.info("Polling for new records.")
return instance.poll(Duration.ofMillis(1000))
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment