Migrating a Library from RxJava To Coroutines
summary
A production library called Store with 3500+ stars and 20+ contributors gets rewritten from RxJava to Coroutines and Flow in Kotlin the code drops the Rx dependency and adds observable Room and network sources a source of truth model writes network responses to disk then emits them via flows multicasting and concurrent request deduplication work in practice tests convert to Kotlin run against the old Store3 suite and use TestCoroutineScope to catch race conditions the project ships as Store 4 alpha and moves to a Dropbox repo for active development
AI-written summary · about
chapters (35)
- 0:00Intro
- 1:26HOW DO YOU PUT IT ALL TOGETHER ?
- 3:20The Repository Pattern
- 3:46What does repository do?
- 4:18Few years back...
- 5:13Why NY Times released Store
- 5:49Build a simple Store
- 6:05Fresh request
- 6:26Get request
- 6:53Building an offline Store
- 7:40Fast forward 3 years
- 8:10Today We'd like to introduce
- 8:50Why Kotlin Coroutines?
- 9:19Structured Concurrency
- 11:23Building a Store
- 12:14Store Stream as First Class Citizen
- 12:28Store stream API
- 14:07Simple case: I want data & updates
- 17:25STREAM SKIP CACHE
- 17:58STREAM NOW WITH OBSERVABLE LOCAL DATA
- 21:12Should Store be The Source of Truth?
- 22:18Reporting Back to Store
- 23:35Supporting source of truth
- 23:59Source of truth gotchas
- 27:17CONCURRENT REQUESTS
- 28:55SHARING FLOWS
- 29:13Sharing in RxJava
- 29:59Context Preservation
- 31:08Store Multicast
- 36:04Migrating Store tests
- 37:56TestCoroutine Scope
- 38:32Catching work leaks
- 41:00Predictable parallel work
- 42:15YES: I JUST RECOMMENDED "DELAY" FOR TESTING :
- 42:50WHAT IS NEXT?
related talks
38mCoroutines by Example
01h 12mA-Z of Kotlin Flow
42mI Swapped RxJava for Coroutines. Why You Should Too
41mHandling billions of events per day with Kotlin Coroutines
02h 47mKotlin 1.4 Online Event, Day 2: Kotlin libraries
41mHandling billions of events per day with Kotlin Coroutines
21mGo with the Flow 🌊
32mNetworking the Kotlin way: Retrofit + Coroutines
