Sounds to me like you could get away with using groupBy
<https://github.com/akka/akka/blob/release-2.3-dev/akka-stream/src/main/scala/akka/stream/scaladsl/Flow.scala#L357>
- where you assemble the group key based on your criteria.
Elements with the same criteria end up in the same "sub-stream".

Have you tried playing around with this idea by adding a groupBy after the
filter step?

On Sun, Nov 16, 2014 at 1:42 AM, Oscar Broman <[email protected]>
wrote:

> Hello!
>
> I've been messing around with akka-streams lately and ran into some
> problems. I'm not sure where to go from this point.
>
> I have a TCP connection to an external data feed, in which I can subscribe
> to a wide variety of real-time data. What exactly will be subscribed to
> changes during runtime.
>
> Messages from the external feed can land in one or many actors, and these
> actors have varying lifespans. Where the messages end up depend on their
> type and different types of information inside them.
>
> How would I do this? From what I gather, using a FlexiRoute means I cannot
> add output ports after it has been materialized.
>
> At one point the stream could look like this:
>
>          tcp io
>            |
>   transform(chop at LF)
>            |
>     map(_.utf8String)
>            |
>   map(FeedMessageParser(_)) // data is now Option(FeedMessage)
>            |
>    filter(_ != None)
>            |
>           /|\
>          / | \
>         /  |  \
>        /   |   \
>       /    |    \
>      /     |     \
>     /      |      \
>  TYPE=1  ID=3   TYPE=4,ID=4 // different prerequisites decide where the
> data flows next
>    |       |      / \
>    |       |     /   \
>    |       |     |   |
>    |       |     |   |
>    |       |     |   |
>   sub1     |     |   |
>          sub2    |   |
>                sub3 sub4
>
>
> How do I do this best? Should I take a step back and look over my options,
> or is there a way to tame the river?
>
> --
> >>>>>>>>>> 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.
>



-- 
Akka Team
Typesafe - The software stack for applications that scale
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 [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