subscribeLoggingDropExceptionsAsync

fun <T, M> Flow<T>.subscribeLoggingDropExceptionsAsync(scope: CoroutineScope, markerFactory: suspend (T) -> M, logger: KSLog = KSLog, block: suspend (T) -> Unit): Job(source)

Subscribes to a Flow with asynchronous processing based on markers, automatically logging and dropping exceptions. Each value from the flow will be processed by the block function. Values with the same marker will be processed sequentially, while values with different markers can be processed concurrently. Any exceptions thrown during processing will be logged and dropped without affecting other messages.

Return

A Job representing the subscription that can be cancelled

Parameters

scope

The CoroutineScope in which to subscribe to the flow

markerFactory

A factory function that produces a marker for each emitted value

logger

The logger instance used for logging exceptions. Defaults to KSLog

block

The suspending function that processes each emitted value

Type Parameters

T

The type of values emitted by the flow

M

The type of markers used to group values