kmongo / org.litote.kmongo / com.mongodb.client.ChangeStreamIterable / listen

listen

fun <T> ChangeStreamIterable<T>.listen(executor: ScheduledExecutorService = Executors.newSingleThreadScheduledExecutor(), delay: Long = 500, unit: TimeUnit = TimeUnit.MILLISECONDS, listener: (ChangeStreamDocument<T>) -> Unit): Unit (source)

Listens change stream in an other thread.

Parameters

executor - the executor service for the thread instantiation - default is Executors.newSingleThreadExecutor

delay - the delay the executor is waiting before submitting the task

unit - the unit of the delay

listener - to listen changes