1. We can send list of messages  and  wait on the returned futures

List responses = new ArrayList();
for(input: recordBatch)
    responses.add(producer.send(input));
for(response: responses)
    response.get

2.  messages will be send in the submission order.

On Mon, Mar 9, 2015 at 1:56 PM, Manikumar Reddy <ku...@nmsworks.co.in>
wrote:

> 1 .
>
>
>
> On Mon, Mar 9, 2015 at 1:03 PM, Yu Yang <yuyan...@gmail.com> wrote:
>
>> The confluent blog
>> <http://blog.confluent.io/2014/12/02/whats-coming-in-apache-kafka-0-8-2/>
>> mentions
>> that the the batching is done whenever possible now. "The sync producer,
>> under load, can get performance as good as the async producer. "  Does it
>> mean that kafka 0.8.2 guarantees that  the sequence of
>> broker-received-message is the same as the async-call sequence by the
>> producer?  If I have code as follows to send messages to the same topic
>> partition:
>>
>> producer.send(msg1);
>> prodcuer.send(msg2);
>> producer.send(msg3);
>>
>> If all three calls succeed, is it possible that broker received msg3
>> before
>> msg2?
>>
>>
>>
>>
>> On Mon, Mar 9, 2015 at 12:17 AM, Yu Yang <yuyan...@gmail.com> wrote:
>>
>> > Hi,
>> >
>> > Kafka 0.8.1.1 allows us to send a list of messages in sync mode:
>> >
>> >     public void send(List<KeyedMessage<K,V> messages);
>> >
>> > I did not find a counter-part of this api in the new producer that is
>> > introduced in kafka 0.8.2. It seems that  we can use the following
>> method
>> > to do sync send in kafka 0.8.2:
>> >
>> >     producer.send(new ProducerRecord(...))).get();
>> >
>> > My understanding is that we can only send one message at a time in
>> > sync-mode. This will limit the throughput of kafka producer. Is there a
>> way
>> > to send a batch of messages in sync mode using kafka 0.8.2 producer?  Is
>> > there any study on the throughput of Kafka 0.8.2 producer, comparing
>> with
>> > kafka 0.8.1.1?
>> >
>> > Thanks!
>> >
>> > Regards,
>> > Yu
>> >
>> >
>> >
>>
>
>

Reply via email to