If the question is whether you need a *new* system for each materializer,
then the answer is no. In fact, 99% of the cases you want to have one
system and reuse it everywhere. Also, there is no need to create a new
materializer in your foreach block. You can create one upfront and just use
it (it is threadsafe, too). In fact, you likely not need more than a couple
of Materializers and those cases are those where you either want to bind
the lifecycle of a bunch of streams to an Actor (then you don't pass the
system as an argument but the context of that actor. When the actor dies,
all streams under that materializer will be terminated). The other use case
for different materializers if you want to shut down a bunch of streams
together by calling materializer.shutdown() which will terminate all
streams belonging to that materializer.

-Endre

On Wed, Mar 2, 2016 at 10:17 AM, Viktor Klang <[email protected]>
wrote:

> I don't understand the question. And looking at the code I don't think it
> would compile.
>
> On Wed, Mar 2, 2016 at 10:15 AM, <[email protected]> wrote:
>
>> system = ActorSystem.create();
>>
>> new Array[]{"a","b"}.stream()
>>       .forEach {
>>             final Materializer m = 
>> ActorMaterializer.create(ActorMaterializerSettings.create(system).withSupervisionStrategy(decider),
>>  system);
>>             pipeLine.to(Sink.foreach(..).run(m);
>>     }
>> }
>>
>>
>> Now only the last pipeline in the loop works?
>> So I am concluding that each
>>
>> Materializer needs its own actorSystem
>>
>>
>>
>> Am Mittwoch, 2. März 2016 10:12:23 UTC+1 schrieb [email protected]:
>>>
>>> I have the following code
>>>
>>>
>>
>>> new Array[]{"a","b"}.stream()
>>>       .forEach {
>>>     }
>>> }
>>>
>>>
>>>
>>>
>>> --
>> >>>>>>>>>> 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.
>>
>
>
>
> --
> Cheers,
> √
>
> --
> >>>>>>>>>> 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