Hi Patrick,

We have the following use case:

Our application is a CQRS System that currently uses akka stream from the 
input(Commands) via command processors to the resulting event stream.

We have two read sides: 
- One that simply consumes events and creates views from the events. This 
one is painless
- The other one creates views to be displayed in our webapplication. There 
is a view for each "HTML" view.

So, we have two kinds of aggregates and to supply the input for the second 
read side I wrote some kind of "preprocessor".

What it does is transforming images, localizing texts and fetching data 
from external services. Async operations combined with some CPU bound stuff.

The processed/precollected data is then the input for the "web-readside".


This  is the way I designed the preprocessor:

It is a 3-level actor hierarchy and only the root is visible as the 
preprocessor.

The second level are two "sub preprocessors"(Fanout/Merge). One for each of 
our two aggregates.

The 3rd level is a pipeline that does the transformation steps, specialized 
for an aggregate.

Each step in the pipeline is an "ActorSubscriber with ActorPublisher". Some 
of them have to initialize themselves and might need some time until they 
are ready.

So what I'm doing is, once an actor in the pipeline is ready, it sends a 
"ConnectMe(in: Subscriber(Sink), out: Publisher(Source))" message to it's 
parent.

Once the parent has collected all the parts, it assembles the the part to 
another in/out pair and sends them to its parent.

The awkward part is how I connect the parts: 
Publischer.subscibe.(nextStepIn) and so on.

What I would like to do is send "ConnectMe(Flow[In, Out]) to the parent(and 
use maybe a FlowGraph or even send a PartialFlowGraph upstairs ;-) ).


As written above, some of my parts are full fledged actors. Most of them 
are finite state machines.


I think this is a not too special example from the application development 
side that needs the possibility to make Flows from an "Actor with 
ActorSubscriber with ActorPublisher".


It's working, but it is not a beauty..... Please make it beautyful!


Best regards,

Christian


BTW: Akka stream really helped us to improve our application and made 
things much easier. And it's fun!


Am Mittwoch, 22. Oktober 2014 19:46:16 UTC+2 schrieb Christian Douven:
>
> Hello!
>
>
> Here's my problem:
>
> I have an Actor which is both an ActorSubscriber[A] and an 
> ActorPublisher[B](Processor?).
>
> Since I want to embed the processor somewhere else, I would like to send 
> around a Flow[A,B] instead of
>
> a Subscriber/Publisher pair and later on connecting them "manually".
>
> Can this be achieved easily?
>
> I already had a look at the taps and drains but got lost...
>
>
>
> Thanks,
>
> Christian
>
>

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