Questions tagged [rx-scala]

RxScala – Reactive Extensions for Scala

RxScala is a library for composing asynchronous and event-based programs using observable sequences.

RxScala is open sourced and available under the Apache License, Version 2.0

91 questions
2
votes
1 answer

Scalaz vs ReactiveX

I´ve been working for a couple years with ReactiveX extension in Java, but now I move to scala, and I´ve seen that many people use the extension ScalaZ to perform more functional programing in Scala. Is there´s any differences to use ScalaZ…
paul
  • 12,873
  • 23
  • 91
  • 153
2
votes
1 answer

Observable takes infinite amount of memory?

Since each Observable has a cache which can be traced back to the very first emitted value it seems an amount of memory used to store this cache is not bounded. I've tested this assumption with the following code: …
src091
  • 2,807
  • 7
  • 44
  • 74
2
votes
1 answer

RxJava/RxScala async code inside Observer.onNext

Let's assume that you want to store events from some stream into the database and a client library to that database is asynchronous. E.g. there is a method writeEvent(event: MyEvent): Future[Boolean] that you have to call inside onNext of your…
2
votes
3 answers

Convert RxJava Observable to RxScala Observable

I am writing a small JavaFx application in Scala and I like to use RxScala and RxJavaFx for this. With the following code I get a RxJava Observable: JavaFxObservable.fromObservableValue(textfield.textProperty()) Obviously, as I write in Scala, I…
RvanHeest
  • 869
  • 6
  • 12
2
votes
2 answers

How to produce one Observable from another

Let's say we have source Observable of Ints: val source:Observable[Int] I would like to create another Observable, producing values whose difference to first appeared value at source is greater than 10: def detect() = Observable[Int]( subscriber…
Nyavro
  • 8,806
  • 2
  • 26
  • 33
2
votes
1 answer

Reactive Extensions (Rx) in Scala - execute a method after a given interval

Since I'm quite new to Reactive Extensions, I was curious about the following things. By using Rx in Scala, I want to be able to call a method that retrieves content from an API every second. So far, I've taken a look at the creational operators…
dsafa
  • 783
  • 2
  • 8
  • 29
2
votes
2 answers

Observable Exception handling

I'm learning RxScala and came to this very synthetic snippet. I'm trying to handle exception in onError block: def doLongOperation():String = { (1 to 10).foreach { _ => Thread.sleep(100) print(".") } println() if…
Nyavro
  • 8,806
  • 2
  • 26
  • 33
2
votes
2 answers

RxScala Observables vs Play Framework Enumerators

How does using Play Frameworks Enumerators, Iteratees, and Enumeratees, compare to using RxScalas Observables, Subscriptions, etc… for asynchronous data flows? In what type of scenarios would you choose to use RxScala, and when would you choose…
zunior
  • 841
  • 2
  • 13
  • 24
2
votes
1 answer

RxScala Observable never runs

With the following build.sbt: name := "blah" version := "1.0" scalaVersion := "2.11.6" libraryDependencies ++= Seq("io.reactivex" % "rxscala_2.11" % "0.24.1", "org.scalaj" %% "scalaj-http" % "1.1.4") and this code: import…
Alex
  • 8,093
  • 6
  • 49
  • 79
1
vote
1 answer

How to build an Observable out of individual computation steps with RxScala/RxJava?

I currently have the following code: def method(): Future[State] = Future { // some processing State.Completed } But now I've noticed that I actually want to "publish" a set of intermediate states instead: def method(): Observable[State] = ? { …
devoured elysium
  • 101,373
  • 131
  • 340
  • 557
1
vote
1 answer

RxScala/Java - Why is my progressBar not showing up?

I have a simple app with a SearchView that users can query and depending on the state I'm showing/hiding some view widgets. I'm having trouble finding out why the ProgressBar is never visible. Can someone say why the loading indicator is never…
user3350744
  • 449
  • 1
  • 5
  • 12
1
vote
0 answers

Why doesn't the Scala compiler infere the parameter type when subscribing to a Flowable with RxScala in Android?

I'm trying to get started with RxJava2, RxScala and Android. I found a little example online which I tried to translate into Scala. But the Scala compiler can't figure out the type here: MainIntent.scala:7:missing parameter type [error] …
user3350744
  • 449
  • 1
  • 5
  • 12
1
vote
1 answer

What is the best practice for managing subscriptions in RxScala?

I want to control the scope for my subscriptions and even in the presence of exceptions while avoiding using var for my subscriptions In Rx/F# I would do this use subscription = Observable.subscribe ... and the subscription is automatically…
vidi
  • 2,056
  • 16
  • 34
1
vote
1 answer

RxScala ConnectableObservable.doOnSubscribe is never called?

val observable = Observable(...) .publish val subscription = observable.connect observable.doOnsubscribe(() => doSomething) .subscribe() The doSomething is never called. The exact same code for RxJava was working properly. It seems for…
Wins
  • 3,420
  • 4
  • 36
  • 70
1
vote
1 answer

Turn TCP socket to Observable of Array[Byte]

In my Android app I need to use a Socket to send and receive arrays of bytes. For convenience sake I want to work with Observable connected to a Socket. Looking on the internet I've found this code: import rx.lang.scala.Observable val s =…
src091
  • 2,807
  • 7
  • 44
  • 74