Monix is a library providing asynchronous programming facilities for Scala and Scala.js.
Questions tagged [monix]
94 questions
2
votes
2 answers
Monix Coeval.memoize blows the stack
Define
def memoizeCoeval(n: Int): Coeval[Int] = {
if (n <= 1)
Coeval.now(1)
else
Coeval.defer(memoizeCoeval(n - 1)).map(_ + 1).memoize
}
Now
memoizeCoeval(10000).value
blows the stack. If we remove the .memoize from the recursive call,…

Kamil Kloch
- 333
- 1
- 9
2
votes
1 answer
How to handle unhandled exception throw in monix onErrorHandle
I am using monix tasks and i am trying to catch a Throwable and then convert to a custom error. I have removed/changed the code to be simple and relevant. This is the code (question follows after the code snippet):
import…

takirala
- 1,891
- 2
- 16
- 36
1
vote
1 answer
Converting monix.eval.Task to scala.concurrent.Future
I’m trying to reuse some module that uses monix.eval.Task for async tasks.
My project uses scala.concurrent.Future.
I'm trying to understand the best way to convert it to Future with the least amount of damage.
The easiest way is to use an…

sheldonzy
- 5,505
- 9
- 48
- 86
1
vote
0 answers
Does back pressure with subject and multicast observable?
I'm wondering how back pressure works when there are multiple subscribers?
For example with a publish subject in monix or with a observable.publish, or with a ConnectableObservable.
I understand with a ConcurrentSubject, there is a buffer so…

Thomas
- 6,032
- 6
- 41
- 79
1
vote
2 answers
Why are results ordered in this Task.parSequenceUnordered? Monix
Because Task.parSequenceUnordered "is like parSequence, except that you don’t get ordering for results or effects.", I would expect the following to return List(2, 1):
import monix.eval.Task
import monix.execution.Scheduler.Implicits.global
object…

Zeke1999
- 35
- 1
- 5
1
vote
1 answer
Monix - Why does this future complete?
Below is a simple program that awaits a cancellable future. The future should evaluate to wait 20 seconds. I'm trying to demonstrate the 5.second max time bound kicking in. However, the program seems to ignore the 5.second max time bound, and waits…

Zeke1999
- 35
- 1
- 5
1
vote
0 answers
Ensuring order of execution in Task.sequence for Monix
I have the below use case .
Execute DB operations in async, after that is done send out a kafka event to another microservice so that it reads from DB. However as of now the kafka event is being sent even before the DB operation is complete. My code…

Sourabh
- 119
- 1
- 8
1
vote
1 answer
Scala diverging implicit expansion for cats.effect.Timer when using monix TaskApp
CE 2.x. Monix 3.4. Line 1 compiles, line 2 gives a compilation error:
diverging implicit expansion for type cats.kernel.Order[A]
starting with method catsKernelOrderForFunction0 in object…

Kamil Kloch
- 333
- 1
- 9
1
vote
0 answers
How is the Partially-Applied Type used in this case Task.Create?
I see this code in monix repo, under the object Task that uses the Partially applied technique. I understand that the technique is used when we want to infer 1 type parameter at a time in a case where inferring both would be impossible, right. Why…

Thomas
- 6,032
- 6
- 41
- 79
1
vote
1 answer
Proper usage of Monix 3.2.2 Observable with Doobie 0.9.0
I would like to use Monix Observable with Doobie (fs2) stream, but can't seem to get it working properly. Without streaming, my test app exits just fine but after using streaming, my TaskApp seems to hang on shutdown and can't figure out why.
Here…

anttik
- 19
- 4
1
vote
1 answer
How can I close the STTP backend after completing my requests?
I am currently learning and playing around with STTP using the Monix backend. I am mainly stuck with closing the backend after all my requests (each request is a task) have been processed.
I have created sample/mock code to resemble my issue (to my…

alt-f4
- 2,112
- 17
- 49
1
vote
1 answer
How can I throttle sending HTTP get requests via Monix?
Build on my earlier question, and with insights from Artem, my objective is to send get requests to a given url, and use Monix's throttling feature to space out the requests (to avoid hitting rate limits).
The expected workflow looks something…

alt-f4
- 2,112
- 17
- 49
1
vote
1 answer
Executing Monix Task in parallel
What is best way to run multiple Monix task in parallel and then get one result?
I have the following tasks and want to get a ResultClass.
import monix.eval.Task
val a: Task[A]
val b: Task[B]
val c: Task[C]
case class ResultClass(a:A, b:B,…

Seongcheol Kim
- 65
- 4
1
vote
4 answers
akka.streams.Source that you can emit values (similar to monix.BehaviorSubject)
I'm looking for akka.stream.scaladsl.Source construction method that will allow me to simply emit next value from different place of code (e.g. watching on system events).
I need somethig similar to Promise. Promise emits single value to Future. I…

Scalway
- 1,633
- 10
- 18
1
vote
0 answers
Best practice for monitoring internal dynamics of a Monix app
I'm in the process of developing a monix-based app. The computation pipeline gets pretty complicated. I wonder what's the best approach to get insights of what's happening during the runtime? Ideally, visualize the tree of observables annotated with…

Sergey Romanovsky
- 4,216
- 4
- 25
- 27