Monix is a library providing asynchronous programming facilities for Scala and Scala.js.
Questions tagged [monix]
94 questions
1
vote
1 answer
Parallel processing of two Observables and convert to a single Observable
I have two Observables created from a single Observable as follows
import monix.reactive.Observable
import scala.collection.immutable
val a: immutable.Seq[(String, String)] = (0 to 10).toList.map(x =>(s"left-$x", s"right-$x"))
val originalStream:…

N A
- 831
- 2
- 8
- 28
1
vote
1 answer
How to broadcast a cold observable: Replay with back-pressure?
I am actually using Scala but the question is generic to all Rx and streaming frameworks.
My use case is that I have a generated observable (thus cold) and I want multiple consumers to consume the exact same values in parallel, but I expect them to…

V-Lamp
- 1,630
- 10
- 18
1
vote
3 answers
How to globally order multiple ordered observables in Monix
Suppose I have multiple iterators that are ordered. If I wanted to merge these iterators while globally ordering them (e.g. [(1,3,4), (2,4,5)] -> [1,2,3,4,4,5]) using monix how would I do it?

BasilTomato
- 1,071
- 1
- 8
- 14
1
vote
0 answers
Reactive observable that captures onrendered state changes (in scalajs / js)
I am working with a library (ScalaJS and react specifically) where I have an interesting situation that I assume is pretty routine for an experienced reactive-programmer. I have a Component with State and a callback shouldComponentUpdate(State). The…

tacos_tacos_tacos
- 10,277
- 11
- 73
- 126
0
votes
0 answers
Why does concurrentsubject have two type parameters?
Why does concurrentsubject have two type parameters but publishsubject has 1.
How does concurrent subject map the input type to the output type?
abstract classConcurrentSubject[I, +O] extends Subject[I, O] with…

Thomas
- 6,032
- 6
- 41
- 79
0
votes
1 answer
Scala Monix: Collect data from Observer.foldLeft
By using Observer, I'm trying to build the code, which:
1.Generate some (random) values;
2.Combine this values;
3.If someone combined value exceed the threshold, the value have to be passed to another handler.
So I expect the resulted value to be…

Jelly
- 972
- 1
- 17
- 40
0
votes
0 answers
In the scala monix package. when i subscribe. how to Avoid using sleep?
Complete all data processing and close the program in time. ! not use sleep? how can i do?
Although sleep will be blocked to achieve the purpose of data processing, I cannot set a reasonable time, too small will lead to data processing cannot be…

chinayangyongyong
- 37
- 1
- 9
0
votes
2 answers
Opportunistic, partially and asyncronously pre-processing of a syncronously processing iterator
Let us use Scala.
I'm trying to find the best possible way to do an opportunistic, partial, and asynchronous pre-computation of some of the elements of an iterator that is otherwise processed synchronously.
The below image illustrates the…

Dyin
- 5,815
- 8
- 44
- 69
0
votes
0 answers
Dealing and Sharing State with a Monix Task in a Recursive Loop
I have the following code that iterates recursively and does something over the network. As it goes over the network, I would like to do some optimizations, where the very first optimization would be to avoid going over the network for certain…

joesan
- 13,963
- 27
- 95
- 232
0
votes
0 answers
Batch insert is throwing error with Quill.io with mariadb when using Monix
On mariadb 10.5.9 and scala 2.13 using MysqlMonixJdbcContext from getquill.io and trying to do a batch insert with
import io.getquill._
val ctx = new MysqlMonixJdbcContext(SnakeCase, "ctx")
import ctx._
val images: List[Image] = ...
run(
…

Akhil
- 538
- 5
- 13
0
votes
1 answer
Handling Errors From Task in Monix
I have the following code snippet that does a simple HTTP look up for a set of URL's.
def parse(filter: ParserFilter): Task[Seq[HttpBinaryResponse]] = {
import scalaj.http._
// Extracts all HTML body anchor elements into an Option
val…

joesan
- 13,963
- 27
- 95
- 232
0
votes
1 answer
The same scala Task code works in sandbox but doesn't work in intelliJ
Just try some simple Task examples. The following code works fine
import monix.eval.Task
import monix.execution.CancelableFuture
import monix.execution.Scheduler.Implicits.global
import scala.util.Success
val task = Task { 1 + 1 }
val cancellable…

Dmitry Reutov
- 2,995
- 1
- 5
- 20
0
votes
2 answers
How can I block terminating my program until the Observable consumption is complete?
I am currently trying to use Monix for throttling api get requests. I have tried using STTP's Monix backend, and it worked fine until couldn't shut down the Monix backend after I was done... As this seems more like an sttp issue than a Monix one, I…

alt-f4
- 2,112
- 17
- 49
0
votes
1 answer
Monix Task with Mongo Collection: Error handling
I am trying to use Monix Task with mongo-scala-driver. I have some trouble understanding Error Handling
val mongoClient: Resource[Task, MongoConnection[Task, DomainModel]] =
MongoTypedConnection.create[Task, DomainModel](
…

irrelevantUser
- 1,172
- 18
- 35
0
votes
1 answer
Fan in/fan out concurrency with Monix
I'm trying to learn Scala and having a good bit of fun, but I'm running into this classic problem. It reminds me a lot of nested callback hell in the early days of NodeJS.
Here's my program in psuedocode:
A task to fetch a list of S3 Buckets.
After…

Breedly
- 12,838
- 13
- 59
- 83