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]> wrote:
> Yes, thanks. I'll explore this.
>
> On Wed, Oct 26, 2016 at 2:04 PM, Roland Kuhn <[email protected]> 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]>:
>> >
>> > 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/c
>> urrent/additional/faq.html
>> >>>>>>>>>>> Search the archives: https://groups.google.com/grou
>> p/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.
>>
>> --
>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
>> urrent/additional/faq.html
>> >>>>>>>>>> Search the archives: https://groups.google.com/grou
>> p/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.
>>
>
>
--
>>>>>>>>>> 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.