Il giorno martedì 12 gennaio 2016 15:48:13 UTC+1, Johan Andrén ha scritto:
>
> Hi Francesco,
>

Hi Johan,
thank you for the reply and sorry for my late reply :)
 

>
> In general the GraphStage is meant to encapsulate smaller
> graph transformations than sub-graphs and the flow API and 
> GraphDSL is the way to go combine graphs. So, one thing 
> might be to reconsider if perhaps your GraphStage is doing
> too many things at one time and you could separate concerns
> into smaller parts which can then more freely be combined.
>   
>
If you have already considered this but feel sure about your
> design, then the materializer is available inside your graph stage
> logic through the materializer method.
>
> It would be very interesting to hear about the use case!
>

My use case was to implement a file writer sink with a rolling policy 
by reusing the synchronous file sink already present in akka-stream.
What I did was to write an AsyncStage that was materializing 
a sub-stream each time a file was rolled over, the source of the sub-stream
was something similar to a Source.queue (to support backpressure) and the 
sink 
was the built-in synchronous file sink.

Combinators as flatMapConcat or flatMapMerge are very useful when
materializing sub-streams starting from a source, but I couldn't find any 
built-in 
combinator to do something similar for a sink. The closest one that I can 
think of is
using SubFlow (and implementing the rolling trigger as a custom stage) but 
I'm not sure that the api to create them are meant to be used openly.
 
Regards,
Francesco


> --
> Johan Andrén
> Typesafe -  Reactive apps on the JVM
> Twitter: @apnylle
>
> On Monday, December 7, 2015 at 4:37:52 PM UTC+1, Francesco Di Muccio wrote:
>>
>> Hi,
>>
>> in all the other stages it is possible to get the Materializer from the 
>> LifecycleContext to materialize sub-graphs, but in GraphStage it isn't 
>> possible, is it by design? 
>>
>> What is the best way to materialize a sub-graph within a GraphStage? For 
>> now my solution is to use a Materializer passed as an implicit parameter to 
>> the stage.
>>
>> Regards,
>> Francesco.
>>
>

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