Oh, right. Thanks. I understand now why the custom stage was written.

On Fri, Apr 28, 2017 at 9:03 AM, Akka Team <akka.offic...@gmail.com> wrote:

> The problem is that Future<T> is not really suited for asynchronous work
> since there is no way to chain actions onto it, the only thing you can do
> is to poll or block until it is completed. It would have to be
> CompletableFuture<T>.
>
> --
> Johan
> Akka Team
>
> On Fri, Apr 28, 2017 at 5:54 PM, Richard Rodseth <rrods...@gmail.com>
> wrote:
>
>> Thanks. There *is* a version of send in Kafka that returns a Java Future.
>>
>> public java.util.concurrent.Future<RecordMetadata 
>> <https://kafka.apache.org/090/javadoc/org/apache/kafka/clients/producer/RecordMetadata.html>>
>>  send(ProducerRecord 
>> <https://kafka.apache.org/090/javadoc/org/apache/kafka/clients/producer/ProducerRecord.html><K
>>  
>> <https://kafka.apache.org/090/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html>,V
>>  
>> <https://kafka.apache.org/090/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html>>
>>  record)
>>
>> Either way, I wish one could write with maximum possible throughput
>> without having a "parallelism" value to tune, but I guess Kafka would have
>> to provide a Reactive Streams compatible API, or Akka would have to drop
>> down to the Kafka protocol level, assuming that is still a thing.
>>
>> On Fri, Apr 28, 2017 at 7:09 AM, Akka Team <akka.offic...@gmail.com>
>> wrote:
>>
>>> 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/ma
>>>>> in/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/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 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/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 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/c
>> urrent/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.
>

-- 
>>>>>>>>>>      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