The Cassandra session provides an async method session.executeAsync which
returns a CompletableFuture/Future which makes it usable with mapAsync
while Kafka has a callback based async api, where you trigger an action and
pass a callback to execute when the action has completed. It would not be
possible to use the latter with mapAsync.

--
Johan
Akka Team

On Sat, Apr 8, 2017 at 1:08 AM, Richard Rodseth <rrods...@gmail.com> wrote:

> I'm still curious what, if any, advantages the ProducerStage as in
> reactive-kafka has over using mapAsync as in CassandraSink. Anyone?
>
>
> On Fri, Mar 31, 2017 at 7:40 AM, Richard Rodseth <rrods...@gmail.com>
> wrote:
>
>> I was looking at the implementation of the reactive-kafka ProducerStage.
>> Very interesting.
>>
>> https://github.com/akka/reactive-kafka/blob/master/core/src/
>> main/scala/akka/kafka/internal/ProducerStage.scala
>>
>> It seems this pattern could be used for any external API that returns a
>> Future.
>>
>> By contrast, the Alpakka CassandraSink uses mapAsyncUnordered with a
>> user-supplied parallelism value.
>>
>> https://github.com/akka/alpakka/blob/master/cassandra/src/
>> main/scala/akka/stream/alpakka/cassandra/scaladsl/CassandraSink.scala
>>
>> Am I correct in understanding that the ProducerStage generates demand
>> (absence of backpressure) only as Futures complete, whereas the
>> CassandraSink generates backpressure (absence of demand) when the
>> parallelism value is reached.
>>
>> In the ProducerStage case, would the max number of in-flight Futures be
>> limited  by the internal buffer size, as described here? :
>>
>> http://doc.akka.io/docs/akka/2.4.17/scala/stream/stream-rate
>> .html#Internal_buffers_and_their_effect
>>
>> Thanks.
>>
>
> --
> >>>>>>>>>> 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.

Reply via email to