Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for RxJava 3 #6871

Open
wezley98 opened this issue May 21, 2020 · 7 comments
Open

Add Support for RxJava 3 #6871

wezley98 opened this issue May 21, 2020 · 7 comments

Comments

@wezley98
Copy link

wezley98 commented May 21, 2020

Describe your problem or use case

Please add support for RxJava 3 to Realm 7+

https://github.com/ReactiveX/RxJava

@wezley98
Copy link
Author

Can also see a dependency on RxAndroid v2 in v7, is this needed?

+--- io.realm:realm-android-library:7.0.0
|    +--- com.google.code.findbugs:jsr305:3.0.2
|    +--- com.getkeepsafe.relinker:relinker:1.4.0
|    +--- io.reactivex.rxjava2:rxandroid:2.1.1
|    \--- io.realm:realm-annotations:7.0.0

@FunkyMuse
Copy link

Can also see a dependency on RxAndroid v2 in v7, is this needed?

+--- io.realm:realm-android-library:7.0.0
|    +--- com.google.code.findbugs:jsr305:3.0.2
|    +--- com.getkeepsafe.relinker:relinker:1.4.0
|    +--- io.reactivex.rxjava2:rxandroid:2.1.1
|    \--- io.realm:realm-annotations:7.0.0
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'

There's a release for rxandroid updated to RxJava3

@strooooke
Copy link

Rxjava 2 support ends on February 28, 2021. This is becoming more pressing.

@cmelchior
Copy link
Contributor

pot8os added a commit to pot8os/pot8os.github.io that referenced this issue Feb 10, 2021
diff --git a/content/blog/2021-02-10.md b/content/blog/2021-02-10.md
new file mode 100644
index 0000000..69aad22
--- /dev/null
+++ b/content/blog/2021-02-10.md
@@ -0,0 +1,39 @@
+---
+title: RxJava2からRxJava3に移行
+date: "2021-02-10T00:00:00.000Z"
+---
+
+というのを目論んでいたのだけど、[Realmが移行する気なかったりする](realm/realm-java#6871
+`import`の置換は特に造作もないけど、テストが結構失敗するようになってしまってその解決に時間がかかってしまった。結論としては何のことはなく、RxJava2をまだ何点か併用する必要があるので、Rxを同期実行させるTestRuleにもその旨両方記載する必要があったのでした。実装例としてはこんな感じ。
+
+```kotlin
+class ImmediateSchedulersRule: TestRule {
+  @OverRide
+  public fun apply(base: Statement, description: Description) {
+    return new Statement() {
+      @OverRide
+      public fun evaluate() {
+        // こっちはRxJava3
+        RxJavaPlugins.setIoSchedulerHandler { Schedulers.trampoline() }
+        RxJavaPlugins.setComputationSchedulerHandler { Schedulers.trampoline() }
+        RxJavaPlugins.setNewThreadSchedulerHandler { Schedulers.trampoline() }
+        // RxJava2が生きてる場合はこちらも
+        io.reactivex.plugins.RxJavaPlugins.setIoSchedulerHandler { io.reactivex.schedulers.Schedulers.Schedulers.trampoline() }
+        io.reactivex.plugins.RxJavaPlugins.setComputationSchedulerHandler { io.reactivex.schedulers.Schedulers.Schedulers.trampoline() }
+        io.reactivex.plugins.RxJavaPlugins.setNewThreadSchedulerHandler { io.reactivex.schedulers.Schedulers.Schedulers.trampoline() }
+        try {
+          base.evaluate()
+        } finally {
+          RxJavaPlugins.reset()
+          // こちらも忘れずに
+          io.reactivex.plugins.RxJavaPlugins.reset()
+        }
+      }
+    }
+  }
+}
+```
+
+### 結論
+
+Realm早く辞めたい
@DouweBos
Copy link

Am I missing something or has this still not happened yet?

@afaucogney
Copy link

Would be good to be updated on that topic @cmelchior. What is the plan about it ?

@MiriamCordes
Copy link

Any updates on this issue @cmelchior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants