All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bdd.reporting.kafka.ManagedKafkaConsumer.kt Maven / Gradle / Ivy

Go to download

BDD Enterprise Reporting Server. This server provides the ability to upload reports from tools like Cucumber, SpecFlow, Pickles and the information is then aggregated into a central view across all projects.

The newest version!
package org.bdd.reporting.kafka

//import org.apache.commons.logging.Log
//import org.apache.commons.logging.LogFactory
//import org.apache.kafka.clients.consumer.ConsumerRecord
//import org.apache.kafka.clients.consumer.KafkaConsumer
//import java.util.concurrent.Executors
//
///**
// * Created by Grant Little [email protected]
// */
//open class ManagedKafkaConsumer(var map: Map,
//                                      val topics : Set) {
//
//    companion object {
//        private val LOG : Log = LogFactory.getLog(ManagedKafkaConsumer::class.java)
//    }
//
//    private var running = true
//    private val taskExecutor = Executors.newSingleThreadExecutor()
//
//    fun start(handler : (ConsumerRecord) -> Unit) {
//        LOG.info("Starting kafka consumer")
//        taskExecutor.execute {
//            LOG.trace("Kafka consumer")
//            val consumer = KafkaConsumer(map)
//            consumer.subscribe(topics)
//            while (running) {
//                try {
//                    LOG.trace("Polling")
//                    val result = consumer.poll(5000)
//                    LOG.info("Returned result $result")
//                    result?.forEach { handler(it) }
//                } catch (e : Exception) {
//                    LOG.error("Exception caught while polling for message", e)
//                }
//            }
//            consumer.close()
//
//        }
//    }
//
//
//    open fun stop() {
//        running = false
//    }
//
//
//}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy