HI Devorb,

>
> I don't understand a couple of things about akka streams:
> 1. are they based on actors or not?
>

Well, yes and no :) The basic unit of execution is a Stage, and the default
materializer creates an actor from it. So in short: currently yes, they are
based on actors, but they don't have to.


> 2. I know I should not execute long running operations in actors (blocking
> things) because of the actors thread pool will be blocked. Can I do that
> inside a GraphStage?
>

Stream stages will be executed over a thread-pool so the same
recommendations apply. Since even actorless implementations will likely to
be based on thread-pools I would say that this is a recommendation for Akka
Streams in general. If you have stages doing blocking or long-running
operations, you should assign those stages to a dedicated dispatcher.


> 3. Why are they 2 ways of defining things like ActorPublisher vs
> SourceShape? Is there a difference in their execution?
>

Originally, there was only ActorPublisher, so that is the older
implementation. It allows you to express your Source directly as an actor.
While it is not deprecated, I think it is less recommended now than before.
If you create a Stage of SourceShape it will also allow you to aquire an
ActorRef that will point to the running stage, so it allows you to do
basically everything you would do with the ActorPublisher. The main
difference is though fusing support. ActorPublisher is not fusable,
therefore it *always* will be a separated actor, while if you do a custom
stage, then it can be fused with later stages to share the same actor.



>
> The concrete thing is this: I want to write a database Source/Sink. Should
> I just create a blocking call inside the onPush/onPull method?
> Or should I use AsyncCallback?
>

If the database gives you an asynchronous interface then you should use
that. If, however it only gives you a blocking API, you can use that, but
be sure to define a dispatcher on that Source to isolate it from the rest
of the system.

-Endre


>
> Thanks, Devorb
>
> --
> >>>>>>>>>> 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.
>

-- 
>>>>>>>>>>      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.

Reply via email to