Well, I want to simply connect them, but I want to connect Sink .actorSubscriber(...) ~> Source.actorPublisher(...), not other way around, like you said.
I've got Actor, that enriches HTTP Requests that our server receives. After some enrichment, I need to be able to send request further down for processing: ``` val source = Source.single(/*HttpRequest*/) val sink = Sink.head[ProcessedRequest] val enrichment: Flow[HttpRequest, EnrichedRequest] = ??? val processing: Flow[EnrichedRequest, ProcessedRequest] = ??? source.via(enrichment).via(processing).to(sink) ``` I want to be able to use our enrichment Actor in Flow[HttpRequest, EnrichedRequest] stage. Actor is able to receive HttpRequest and reply (or forward) ProcessedRequest, but I don't know how to create Flow from it. чт, 20 авг. 2015 г. в 18:20, Konrad Malawski <[email protected]>: > Hello there Alexey, > I'm not sure I understand what you want to achieve, is it simply to > connect such Sink to the Source? > That's simply: > Source.actorPublisher(...).to(Sink.actorSubscriber(...)).run() > > Or do you mean to put another processing stage between them? > If so then read about custom processing stages: > doc.akka.io/docs/akka-stream-and-http-experimental/1.0/scala/stream-customize.html > > > -- > Cheers, > Konrad Malawski > Akka @ Typesafe > > On 20 August 2015 at 17:12:55, Alexey Shuksto ([email protected]) wrote: > > Hello there, > > I could not find answer to this particular question neither in docs nor in > this group: > > Is it possible to wire Sink.actorSubscriber(...) into > Source.actorPublisher(...) in one (Partial-) Flow? And by 'wire' I mean to > somehow send message from ActorSubscriber, instantiated from given props, > to the 'same flow' instance of ActorPublisher? > > I was thinking about giving some unique Id to both of them and then > publish/subscribe events through `context.system.eventStream`, but then I > realized that all materialized flows would have same Id and messages would > mess up... :( > > In fact, I'm interested in even more simple task -- create an Actor, that > could act as PartialFlow[In, Out]: when you push a value into flow, actor > receives it, processes and sends further down the line. > > Of course, I always could do something like Flow[In] mapAsync (data => > (actor ? data).mapTo[classOf[Out]]) -- but I would really, really prefer to > do this message way. > > -- > >>>>>>>>>> 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. > > -- >>>>>>>>>> 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.
