There's an issue on file for doing the filter & nonFilter in a single graph 
element: https://github.com/akka/akka/issues/17038
Meanwhile, you can a use less powerful variant using FlexiRoute: 
https://github.com/rkrzewski/akka-cluster-etcd/blob/master/etcd-client/src/main/scala/pl/caltha/akka/streams/EitherJunction.scala
Usage 
example: 
https://github.com/rkrzewski/akka-cluster-etcd/blob/master/etcd-client/src/main/scala/pl/caltha/akka/http/HttpRedirects.scala#L59
The project binares are not published anywhere, so feel free to copy-paste 
the code if you find it useful :)

Cheers,
Rafał

W dniu wtorek, 1 września 2015 20:54:48 UTC+2 użytkownik Lance Arlaus 
napisał:
>
> 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