Hi,

I started working on something similar for akka-contrib 
(https://github.com/akka/akka-stream-contrib/issues/50). There is a PR 
there with a "basic" implementation that also supports filtering and 
splitting messages (and materialized values), but I got a little stuck 
trying to generalize it and adding support for mapAsync (in the internal 
flow). I should probably make some time and get back to it sometime soon, 
but in the meantime you can have a look and just copy-paste it (or if you 
have feedback, that would also be helpful).

Tal


On Thursday, October 27, 2016 at 1:46:42 AM UTC+3, rrodseth wrote:
>
> I came up with this before realizing my Flow (at least currently) is not 
> 1:1 :(
>
>   def kafka1to1Flow[In,Out](job: Flow[In, Out, _]): 
> Graph[FlowShape[CommittableMessage[_,In], (Out, CommittableMessage[_,In])], 
> NotUsed] = {
>
>     val result = GraphDSL.create() { implicit b =>
>
>       import GraphDSL.Implicits._
>
>       val toValue: FlowShape[CommittableMessage[_,In], In] = 
> b.add(Flow[CommittableMessage[_,In]].map(_.record.value))
>
>       val bcast: UniformFanOutShape[CommittableMessage[_,In], 
> CommittableMessage[_,In]] = b.add(Broadcast[CommittableMessage[_,In]](2))
>
>       val zip: FanInShape2[Out, CommittableMessage[_,In], (Out, 
> CommittableMessage[_,In])] = b.add(Zip[Out, CommittableMessage[_,In]]())
>
>       bcast.out(0) ~> toValue ~> job ~> zip.in0
>
>       bcast.out(1) ~> zip.in1
>
>       FlowShape(bcast.in, zip.out)
>
>     }
>
>     result
>
>   }
>
> On Wed, Oct 26, 2016 at 2:08 PM, Richard Rodseth <[email protected] 
> <javascript:>> wrote:
>
>> Yes, thanks. I'll explore this.
>>
>> On Wed, Oct 26, 2016 at 2:04 PM, Roland Kuhn <[email protected] 
>> <javascript:>> wrote:
>>
>>> Yes, indeed: if it is strictly 1:1 and it retains the order of the 
>>> messages, then this works. Thanks for the sample!
>>>
>>> Regards,
>>>
>>> Roland
>>>
>>> > 26 okt. 2016 kl. 22:12 skrev Itamar Ravid <[email protected] 
>>> <javascript:>>:
>>> >
>>> > Broadcast/Zip if your existing flow is 1:1. Here's a sample: 
>>> https://github.com/iravid/stream-processing-talk/blob/master/GraphDSL.scala#L86
>>> >
>>> > --
>>> >>>>>>>>>>>     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] <javascript:>.
>>> > To post to this group, send email to [email protected] 
>>> <javascript:>.
>>> > 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 [email protected] <javascript:>.
>>> To post to this group, send email to [email protected] 
>>> <javascript:>.
>>> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to