Quantcast
Channel: Akka Libraries - Discussion Forum for Akka technologies
Viewing all articles
Browse latest Browse all 1362

Custom GraphStage

$
0
0

Hi,

I’m thinking about using a custom GraphStage like the following:

case class MapAsyncErrorUnordered[In, Out](parallelism: Int, f: In => Future[Out])
extends GraphStage[FanOutShape2[In, Out, Throwable]]

So if Future is success an element will be generated in output 1 and, if Future ends with failure, a Throwable wil be generated in output 2. This would allow me to apply different pipeline for errors and successful cases.

If I go this way like I sketched up here custom-shapes/src/main/scala/shapes/MapAsyncErrorUnordered.scala at main · bcoromina/custom-shapes · GitHub, looks like I break encapsulation of graph component so I should test by myself that I’m not breaking things like correct backpreasure handling in my custom shape.

If you do think this is the way to go I would appreciate some advice for testing the new shape, otherwise, maybe you could suggest a better aproach.

Thanks in advance,

Bernat

5 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 1362