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
0
votes
1 answer

Restart Observable connected to a resource

In the following code I turn a TCP socket into an Observable[Array[Byte]]: import rx.lang.scala.Observable import rx.lang.scala.schedulers.IOScheduler val sock = new Socket type Bytes = Array[Byte] lazy val s: Observable[Bytes] = Obs.using[Bytes,…
src091
  • 2,807
  • 7
  • 44
  • 74
0
votes
2 answers

How to create an observable of the difference between two sorted observables?

Let's say I have two observables of sorted doubles. I'd like to get the difference between them as an observable. For instance: 1 2 4 left: ──o───────o───────────o────/ 1 3 4 5 right: …
0
votes
1 answer

Backpressure observable based on resource scarcity

In RxJava 1 / RxScala, how can I throttle/backpressure a source observable in the following situation? def fast: Observable[Foo] // Supports backpressure def afterExpensiveOp: Observable[Bar] = fast.flatMap(foo =>…
dtech
  • 13,741
  • 11
  • 48
  • 73
0
votes
1 answer

Akka Streams - combine latest operation

I'd like to combine-latest with Akka Streams as described here. I can't figure out how to do it - please help! Thanks, Ryan.
Ryan Worsley
  • 655
  • 1
  • 4
  • 17
0
votes
1 answer

RxScala based on RxJava 2.0

RxJava 2.0 is close to be finished (RC3). Is there an (experimental) RxScala implementation that is based on this version? RxJava 2.0 targets Java 8. Does this have any implications on RxScala, e.g. will Scala 2.12 be a prerequisite?
0
votes
2 answers

Rx programming, how to combine item with former element in single observable?

If we have the observable: 1 -> 2 -> 3 -> 4 -> 5 -> ... how to construct to the new observable: (1, 2) -> (3, 4) -> ... Maybe the question to short but I really not find how to achieve.Thank you Thanks every one ,I find a method and under…
LoranceChen
  • 2,453
  • 2
  • 22
  • 48
0
votes
1 answer

Controlling observable buffering by observable itself

I'm trying to slice observable stream by itself, eg.: val source = Observable.from(1 to 10).share val boundaries = source.filter(_ % 3 == 0) val result = source.tumblingBuffer(boundaries) result.subscribe((buf) => println(buf.toString)) Te output…
Petr S.
  • 63
  • 5
0
votes
1 answer

Why doesn't this execute the function given for RxScala's doOnSubscribe function?

val x: Observable[Int] = Observable.just(1).doOnSubscribe(() => println(s"subscribed")) val y = x.subscribe(t => println(s"got item: $t")) println("all done") I would have thought this code would print subscribed got item: 1 all done But it…
James Moore
  • 8,636
  • 5
  • 71
  • 90
0
votes
1 answer

How does the RxJava/Scala Observable garbage used data?

I'm fresh at Rx, I have seem Observable buffer event data. With cold observable or replay that makes data stream will emit to later observer even through long time later. But when it will be garbaged?Besides, what's should be care for memory when…
LoranceChen
  • 2,453
  • 2
  • 22
  • 48
0
votes
0 answers

How to make a subscribe as a Observable?

I'm use RxScala/Java construct a Observable to emit socket connection with a loop,the result is every connection as a event.Like this, val server = new ServerEntrance("localhost", 10002) val socket: Observable[ConnectedSocket] = server.listen After…
LoranceChen
  • 2,453
  • 2
  • 22
  • 48
0
votes
1 answer

RxScala subscribe with multi Observer just emit event to first one

I attempt use multi Observer subscribe a Observable which onNext occurred within a loop.It seems not work for every Observer. import rx.lang.scala.Observable object SubscribeMultiEvent extends App{ val obv = Observable.apply[String]{ s => def…
LoranceChen
  • 2,453
  • 2
  • 22
  • 48
0
votes
0 answers

Rx Observable of state, when state transition can fail

Given computation which infinitely generates new value based on previous one and incoming event, that may also fail, which is the best way to obtain two Observables: potentially infinite, for successful transformations, for error…
Oleg Pyzhcov
  • 7,323
  • 1
  • 18
  • 30
0
votes
1 answer

Can't print items of the observables after grouped

Can't understand why the following rxscala code is not working as expected: import rx.lang.scala.Observable object MyTest extends App { case class ProjectEvent(projectName: String, description: String) val projectEvents:…
Freewind
  • 193,756
  • 157
  • 432
  • 708
0
votes
1 answer

Transforming Observables in RxJava and RxScala

I have an Observable that emits a List of entries as below: val obsList: Observable[List[MyEntry] = Observable.from(getListEntry) // getListEntry would give me a List[MyEntry] How could I now get the contents piped into another Observable that…
joesan
  • 13,963
  • 27
  • 95
  • 232
0
votes
1 answer

Why does `collect` make the observer received no notifications?

I'm using rxscala and found a very subtle problem, and my code is simplied to the following: import rx.lang.scala.Observable import rx.lang.scala.subjects.PublishSubject object SubtleBug extends App { case class Projects(projects: List[Project]…
Freewind
  • 193,756
  • 157
  • 432
  • 708