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

goodmetrics.pipeline.BatchSender.kt Maven / Gradle / Ivy

The newest version!
package goodmetrics.pipeline

import goodmetrics.downstream.GoodmetricsClient
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch

class BatchSender private constructor() {
    companion object {
        fun  CoroutineScope.launchSender(upstream: MetricsPipeline, client: GoodmetricsClient, send: suspend GoodmetricsClient.(batch: TBatch) -> Unit): Job {
            return launch {
                upstream.consume()
                    .collect { batch ->
                        client.send(batch)
                    }
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy