You mean like: Source.single(()).flatMapConcat(_ => yourFunction())?

-- 
Cheers,
√

On Feb 8, 2017 03:33, "hbf" <k...@iaeth.ch> wrote:

> Heya everybody!
>
> I know that Akka Stream elegantly distinguishes *describing* a graph from
> *materializing* a graph.
>
> When working on custom Akka Stream sink/sources, I often find myself
> looking for a simple way to create a source (or sink) from a function that
> gets called at materialization time. However, I don't see this in the
> Source/Sink companion object.
>
> Examples:
>
>    - Create a source that returns the results from a single HTTP call
>    when materialized.
>    - Create a sink that when materializes opens a connection to Redis and
>    writes to it.
>
> In both cases, I'd like the some action (make the HTTP request, open the
> connection) to only take part when we materialize, and each time we
> materialize the flow.
>
> Am I missing something?
>
> Thanks for any feedback!
> Hbf
>
> P.S. I know I can use the GraphStage API to achieve this (and that's what
> I'm doing) but I think it might be nice to have this functionality in a
> more visible API – if what I say makes sense.
>
> --
> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> 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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
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