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.
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