Awesome, thanks everyone On Wed, Nov 19, 2014 at 3:48 PM, Patrik Nordwall <[email protected]> wrote:
> Boris, that is a bug in mapConcat. Please create an issue > <https://github.com/akka/akka/issues>, and I will fix it immediately. > > Thanks for reporting. > > Cheers, > Patrik > > On Wed, Nov 19, 2014 at 1:30 PM, Boris Lopukhov <[email protected]> wrote: > >> Using transform instead of the mapConcat worked well for me: >> >> val list = List.range(1, 21).grouped(5).toList >> Source(list).transform("myMapConcat", () => new Transformer[List[Int], >> Int] { >> override def onNext(list: List[Int]) = list >> }).runWith(ForeachSink(println)) >> >> result: 1..20 >> >> May this be a bug in mapConcat? I am using version 0.11 >> >> вторник, 18 ноября 2014 г., 17:29:54 UTC+4 пользователь Boris Lopukhov >> написал: >> >>> No, the actor system is alive. Additionally, i have repeated that code >>> many times with the same result: >>> >>> for (i <- 1 to 10) { >>> Source(list).mapConcat(x => x).runWith(ForeachSink(println)) >>> } >>> >>> >>> >>> вторник, 18 ноября 2014 г., 16:29:08 UTC+4 пользователь Patrik Nordwall >>> написал: >>>> >>>> Do you shutdown the actor system prematurely? >>>> /Patrik >>>> >>>> On Tue, Nov 18, 2014 at 1:24 PM, Boris Lopukhov <[email protected]> >>>> wrote: >>>> >>>>> I have isolated the problem, it seems that ActorPublisher is not the >>>>> cause: >>>>> >>>>> val list = List.range(1, 21).grouped(5).toList >>>>> Source(list).mapConcat(x => x).runWith(ForeachSink(println)) >>>>> >>>>> expectation: 1..20 >>>>> reality: 1..16 >>>>> >>>>> >>>>> понедельник, 17 ноября 2014 г., 19:46:58 UTC+4 пользователь Boris >>>>> Lopukhov написал: >>>>> >>>>>> Hi everyone! >>>>>> >>>>>> I am trying to create a stream with an ActorPublisher: >>>>>> >>>>>> class SourceActor extends ActorPublisher[List[Int]] { >>>>>> import akka.stream.actor.ActorPublisherMessage.Request >>>>>> >>>>>> var list = List.range(1, 21).grouped(5).toList // for example >>>>>> >>>>>> def receive = { >>>>>> case Request(elems) => while (totalDemand > 0 && isActive) { >>>>>> list match { >>>>>> case Nil => >>>>>> onComplete() >>>>>> self ! PoisonPill >>>>>> case head :: tail => >>>>>> list = tail >>>>>> onNext(head) >>>>>> } >>>>>> } >>>>>> } >>>>>> } >>>>>> >>>>>> val sourceActor = system.actorOf(Props[SourceActor]) >>>>>> val source = Source(ActorPublisher[List[Int]](sourceActor)) >>>>>> val out = ForeachSink(println) >>>>>> source.mapConcat{x => x}.runWith(out) >>>>>> >>>>>> I expect to see numbers from 1 to 20, but random printed from 1 to >>>>>> 17~19 >>>>>> As I understand, it occur due to the stream complete before all >>>>>> elements are processed. How can I implement an ActorPublisher properly >>>>>> and >>>>>> escape this problem? >>>>>> >>>>>> -- >>>>> >>>>>>>>>> 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. >>>>> >>>> >>>> >>>> >>>> -- >>>> >>>> Patrik Nordwall >>>> Typesafe <http://typesafe.com/> - Reactive apps on the JVM >>>> Twitter: @patriknw >>>> >>>> -- >> >>>>>>>>>> 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. >> > > > > -- > > Patrik Nordwall > Typesafe <http://typesafe.com/> - Reactive apps on the JVM > Twitter: @patriknw > > -- > >>>>>>>>>> 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. > -- Cheers, √ -- >>>>>>>>>> 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.
