What are you expecting to be returned? -- Cheers, √ On Apr 26, 2016 3:49 PM, "Debasish Ghosh" <ghosh.debas...@gmail.com> wrote:
> Thanks Konrad for the pointer .. when I run the graph I get a NotUsed .. > That's not hwat I get with the earlier implementation. Please have a look > at the gist .. > https://gist.github.com/debasishg/a42e867bb2bc8ad18243597178bbce93 .. > what am I doing wrong. > > Thanks. > > On Tue, Apr 26, 2016 at 6:22 PM, Konrad Malawski < > konrad.malaw...@typesafe.com> wrote: > >> (I did a quick mock Transaction type, your Monoid should work fine there >> ofc). >> >> -- Konrad >> >> On Sunday, 24 April 2016 21:42:43 UTC+2, debasish wrote: >> >>> Hi - >>> >>> I am trying to migrate some akka-streams code from an earlier version >>> (akka-stream-experimental 1.0.RC4) .. please have a look at the following .. >>> >>> /** >>> * Create multiple streams out of a single stream. The stream >>> "transactions" is being >>> * demultiplexed into many streams split by account number. Each of the >>> sub-streams are >>> * then materialized to the fold sink "txnSink", which folds each of the >>> transaction >>> * substreams to compute the net value of the transaction for that >>> account >>> */ >>> val netTxn: Source[RunnableGraph[Future[Transaction]], Unit] = >>> transactions.map(validate).groupBy(_.accountNo).map { case (a, s) => >>> s.toMat(txnSink)(Keep.right) } >>> >>> I am trying to create substreams based on a field accountNo within a >>> Transaction. Then I pass each substream to toMat with a Sink which is a >>> fold Sink defined as below .. >>> >>> /** >>> * Would like to fold transactions through monoid append >>> */ >>> val txnSink: Sink[Transaction, Future[Transaction]] = >>> Sink.fold[Transaction, Transaction](TransactionMonoid.zero)(_ |+| _) >>> >>> The idea is to apply a monoid over each substream and do some netting on >>> transactions belonging to the same accountNo. >>> >>> How can I migrate this to 2.4.4 ? Now groupBy returns a Subflow and I >>> am not sure how to apply each of the substreams to the materializer. One >>> option that works will be to create a Map[String, Transaction] upfront >>> and then directly apply the monoid to the Map in the main stream and >>> not create any substream. But I would like to have the substreams fro some >>> other purpose as well. >>> >>> Any help will be appreciated .. >>> >>> Regards. >>> - Debasish >>> >>> >>> >>> >>> -- >> >>>>>>>>>> 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 a topic in the >> Google Groups "Akka User List" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/akka-user/YhJfghLqnhw/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> akka-user+unsubscr...@googlegroups.com. >> To post to this group, send email to akka-user@googlegroups.com. >> Visit this group at https://groups.google.com/group/akka-user. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Debasish Ghosh > http://manning.com/ghosh2 > http://manning.com/ghosh > > Twttr: @debasishg > Blog: http://debasishg.blogspot.com > Code: http://github.com/debasishg > > -- > >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com. > To post to this group, send email to akka-user@googlegroups.com. > Visit this group at https://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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.