Hello, I want to receive & process some events (t...
# flow
s
Hello, I want to receive & process some events (triggered by the user or over HTTP) and I want to have it act like as something similar FIFO queue with a size of 1 (keep the latest event). Can I use this or should I use a Channel?
Copy code
private val manualPinKeySynchronizationEvents = MutableSharedFlow<Any>(
        replay = 1,
        extraBufferCapacity = 1,
        onBufferOverflow = BufferOverflow.DROP_OLDEST
    )
I use
replay = 1
so that if there are any events before I start collecting this flow I don't miss them. Later on I use this flow in the following way:
Copy code
merge(failedSynchronizationsSource(), manualSynchronizationSource())
            .distinctUntilChanged()
            .mapLatest { synchronizationRequired ->
                 ...