Reactive Data Flow in Revolut Android App
Article Summary
Roman Iatcyna from Revolut reveals how they built a reactive data layer that handles offline-first architecture at scale. Their solution? A custom DataObservableDelegate that abstracts away the complexity of multi-source data management.
Revolut's Android app supports full offline mode across every screen, requiring sophisticated data synchronization between memory cache, database, and network. The team built a reactive architecture using RxJava that automatically manages cache-first strategies while keeping the domain layer simple. They've now open-sourced this as RxData library.
Key Takeaways
- Two-level cache system: memory cache beats DB, DB only queried once per session
- DataObservableDelegate wraps complex offline logic into single reusable component
- Cache-first strategy renders UI instantly, then updates from network seamlessly
- Repository contract returns Observable<Data<T>> with loading, content, and error states
- Open-sourced as RxData library with comprehensive test coverage
Revolut abstracted their entire offline data flow into a single delegate pattern that handles memory cache, database persistence, and network requests automatically while exposing a simple Observable interface to developers.