Re: [akka-user] [akka-stream] Is there a way to access Configuration from Flow?

2016-02-22 Thread Akka Team
Hi Alexey,

There is no built-in way to access the configuration, but as you noted, you
can inject it as an element. This is actually safe because configuration in
Akka systems is always immutable. Technically, you can even close over a
val containing the configuration but be careful though because you will
retain the whole enclosing class and that might result in a leak.

A third option is to write a custom source, and inject the configuration as
a custom Attribute, and then let your source emit it. This means that you
can construct a graph upfront, and then provide the configuration at
materialization time by attaching the right Attribute.

-Endre

On Wed, Feb 17, 2016 at 12:07 PM, Alexey Shuksto  wrote:

> Hello there,
>
> Is there a way to access run-time system configuration in
> GraphDSL.create(...) similar to as any Actor could access one via
> `context.system.settings.config`?
>
> I can, possibly do something like `flow.zip(Source.repeat(config))`, but
> maybe there is some approach that will not require to provide ActorSystem
> of Config to graph creation procedure?
>
> --
> >> 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.
>



-- 
Akka Team
Typesafe - Reactive apps on the JVM
Blog: letitcrash.com
Twitter: @akkateam

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


[akka-user] [akka-stream] Is there a way to access Configuration from Flow?

2016-02-17 Thread Alexey Shuksto
Hello there,

Is there a way to access run-time system configuration in 
GraphDSL.create(...) similar to as any Actor could access one via 
`context.system.settings.config`?

I can, possibly do something like `flow.zip(Source.repeat(config))`, but 
maybe there is some approach that will not require to provide ActorSystem 
of Config to graph creation procedure?

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