I'm having a couple of problems understanding the Streams documentation,
in particular, the Overview of built-in stages
<http://doc.akka.io/docs/akka/2.4/scala/stream/stages-overview.html>.
My objective is to build, using the GraphDSL, a flow that uses, among
others, a Source.actorRef
Flow.fromGraph(GraphDSL.create() { implicit b =>
import GraphDSL.Implicits._
val src = b.add(Source.actorRef[Any](bufferSize, OverflowStrategy.fail
).mapMaterializedValue(workerSupervisor ! SetWorkRecipient(_)))
...
I've used Source.actorRef[Any]because my workerSupervisor (the actor that
provides the messages for the source) wants to return a result of type
WorkResult
However, the documentation says that this stage completes when it receives
akka.actor.Status.Success
So if I use Source.actorRef[WorkResult] I run into trouble once the work is
complete and the worker wants to signal success, because, of course, the
success message is of the wrong type.
How can I work around this? I need my stream to emit WorkResult, not Any ;
It's not clear from the documentation how to achieve it.
Also, the documentation lists the following stages (for example)
broadcast, which I add as b.add(Broadcast[T](2)) for example.
and
map & collect, which can't be added in the same way (i.e. no b.add(Map[T]))
yet there is no notation in the documentation that suggests that these
stages might be different or used differently. My thought was to convert
the Any from the Source.actorRef using collect, yet, I'm struggling with
doing that.
So my 2nd question is, how do I apply map or collect to the output of a
Broadcast[T] within the context of a GraphDSL and provide the mapped output
as part of the resulting FlowShape?
Would you kindly show an example using GraphDSL?
Thank you!
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.