Gioele Dev
07/17/2023, 6:31 PMGioele Dev
07/17/2023, 6:32 PMvar channelScope = CoroutineScope(<http://Dispatchers.IO|Dispatchers.IO> + Job())
val channel : Channel<TLocalEntityInterface> = Channel<TLocalEntityInterface>()
override suspend fun send( elem: TLocalEntityInterface) {
channelScope.launch {
channel.send(elem)
}
}
override suspend fun startChannel( ) {
for (element in channel) {
var entity = channel.receive()
logRepository.tag("sync").d("sync: startChannel stampo un elmentot ${entity}".toUpperCase())
when(entity){
is MyType -> {
Timber.tag("sync").d(": nome ${entity.name}")
}
}
}
}
Gioele Dev
07/17/2023, 6:42 PMPablichjenkov
07/17/2023, 6:52 PMGioele Dev
07/17/2023, 6:55 PMPablichjenkov
07/17/2023, 6:55 PMchannel.consumeEach
Gioele Dev
07/17/2023, 6:56 PMPablichjenkov
07/17/2023, 6:57 PMGioele Dev
07/17/2023, 7:00 PM