Re: [akka-user] Re: [akka-hhtp][akka-streams] Process http request with flow

2015-06-15 Thread Martynas Mickevičius
Hi Vladimir, it is possible to complete the request with a Source (no materialization needed) if you provide a marshaller for the source. You need marshaller in this case basically only to set the content type of your response. In your case, you would prepare a Source with: val mySource = Sourc

Re: [akka-user] Re: [akka-hhtp][akka-streams] Process http request with flow

2015-06-09 Thread Владимир Морозов
Hi, I try to write complete code example: import akka.actor.{ActorSystem, Props}import akka.http.scaladsl._import akka.http.scaladsl.server.Directives._import akka.http.scaladsl.server._import akka.stream.ActorFlowMaterializerimport akka.stream.actor.ActorPublisherimport akka.stream.scaladsl.{

Re: [akka-user] Re: [akka-hhtp][akka-streams] Process http request with flow

2015-06-09 Thread Viktor Klang
Hi, I don't understand what you mean. What does "Does not solve my problem" mean in this case? What -is- the result of the flow? On Tue, Jun 9, 2015 at 9:30 AM, Владимир Морозов wrote: > Hi, > > Oh... but if I change Sink.ignore to Sink.head[String] (for example) it > not solve my problem, beca

Re: [akka-user] Re: [akka-hhtp][akka-streams] Process http request with flow

2015-06-09 Thread Владимир Морозов
Hi, Oh... but if I change Sink.ignore to Sink.head[String] (for example) it not solve my problem, because ref (my stream) have type ActorRef. What type of Sink I need to use, for obtain result of flow, if as source used actorPublisher? вторник, 9 июня 2015 г., 10:23:41 UTC+3 пользователь √ нап

Re: [akka-user] Re: [akka-hhtp][akka-streams] Process http request with flow

2015-06-09 Thread Viktor Klang
The results will travel to the Sink, so you'll have to not `ignore` the result. On Tue, Jun 9, 2015 at 9:15 AM, Владимир Морозов wrote: > Hi, > > I play more with actorPublisher, yes it is great thing, but - when I have > stream like this: > > val jobManagerSource = Source.actorPublisher[UserReg

Re: [akka-user] Re: [akka-hhtp][akka-streams] Process http request with flow

2015-06-09 Thread Владимир Морозов
Hi, I play more with actorPublisher, yes it is great thing, but - when I have stream like this: val jobManagerSource = Source.actorPublisher[UserRegisterSource. RegisterUser](UserRegisterSource.props) val ref = Flow[UserRegisterSource.RegisterUser] .mapAsync(1)(callMe) .to(Sink.ignore) .runWith

Re: [akka-user] Re: [akka-hhtp][akka-streams] Process http request with flow

2015-06-07 Thread Владимир Морозов
I solve this problem, but found new one: val ref = Flow[UserRegisterSource.RegisterUser] .mapAsync(1)(callMe) .to(Sink.ignore) .runWith(jobManagerSource) val t = (ref ask UserRegisterSource.RegisterUser("test")).mapTo[UserRegisterSource.RegisterUser] but t never complete, always end with Timeou

Re: [akka-user] Re: [akka-hhtp][akka-streams] Process http request with flow

2015-06-07 Thread Владимир Морозов
Hi, I try but get error message: java.lang.IllegalStateException: onNext is not allowed when the stream has not requested elements, totalDemand was 0 My code is: val jobManagerSource = Source.actorPublisher[UserRegisterSource.RegisterUser](UserRegisterSource.props) val ref = Flow[UserRegiste

Re: [akka-user] Re: [akka-hhtp][akka-streams] Process http request with flow

2015-06-07 Thread Akka Team
Hi, On Fri, Jun 5, 2015 at 7:53 PM, Владимир Морозов wrote: > Yes, I know about mapAsync, but my problem with Source. A want to use > single stream for processing some group of events > I am not sure if I understand your question properly, but if you want to run the stream *once* and then reuse

[akka-user] Re: [akka-hhtp][akka-streams] Process http request with flow

2015-06-05 Thread Владимир Морозов
Yes, I know about mapAsync, but my problem with Source. A want to use single stream for processing some group of events пятница, 5 июня 2015 г., 20:29:16 UTC+3 пользователь Paul Kinsky написал: > > Use mapAsync: `def mapAsync[T](parallelism: Int)(f: (Out) ⇒ Future[T]): > Repr[T, Mat]`. > > On Fr

[akka-user] Re: [akka-hhtp][akka-streams] Process http request with flow

2015-06-05 Thread Paul Kinsky
Use mapAsync: `def mapAsync[T](parallelism: Int)(f: (Out) ⇒ Future[T]): Repr[T, Mat]`. On Friday, June 5, 2015 at 9:23:24 AM UTC-7, Владимир Морозов wrote: > > Hi all, > > I have some simple application based on akka streams and http: > > My Flow items: > > val resultSink = Sink.head[String] > >