Thanks a lot!
It's really helpful!

Leon


在 2015年9月1日星期二 UTC-7上午11:54:48,Lance Arlaus写道:
>
> Leon-
>
> There's a couple of ways to solve this, but one simple solution is to use 
> a combination of Broadcast, filter, and Merge.
> 1. Broadcast the elements to two branches and filter each branch. Assuming 
> the respective filters are mutually exclusive, each element will only go 
> down a single branch.
> 2. Place the FlowB on the desired branch to receive extra processing.
> 3. Place the Merge prior to FlowC to join the two branches
>
> The result will look something like this:
> FlowA ~> bcast ~> nonfilter ~> FlowB ~> merge
>                           ~> filter                       ~> merge
>                                                              ~> merge.out 
> ~> FlowC
>
> However, an even simpler solution, depending on your requirements, is to 
> just implement FlowB as a map stage that passes through on false match. 
> Something like:
>
> val flowB = Flow[T].map(e => cond(e) match {
>   case true => // do something
>   case false => e
> }
>
> You can then just chain via() calls (flowA.via(flowB).via(flowC)). A wee 
> bit simpler if it fits your case.
>
> Lance
>
>

-- 
>>>>>>>>>>      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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to