org.apache.kafka.clients.producer.internals
Class ProduceRequestResult

java.lang.Object
  extended by org.apache.kafka.clients.producer.internals.ProduceRequestResult

public final class ProduceRequestResult
extends java.lang.Object

A class that models the future completion of a produce request for a single partition. There is one of these per partition in a produce request and it is shared by all the RecordMetadata instances that are batched together for the same partition in the request.


Constructor Summary
ProduceRequestResult()
           
 
Method Summary
 void await()
          Await the completion of this request
 boolean await(long timeout, java.util.concurrent.TimeUnit unit)
          Await the completion of this request (up to the given time interval)
 long baseOffset()
          The base offset for the request (the first offset in the record set)
 boolean completed()
          Has the request completed?
 void done(TopicPartition topicPartition, long baseOffset, java.lang.RuntimeException error)
          Mark this request as complete and unblock any threads waiting on its completion.
 java.lang.RuntimeException error()
          The error thrown (generally on the server) while processing this request
 TopicPartition topicPartition()
          The topic and partition to which the record was appended
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProduceRequestResult

public ProduceRequestResult()
Method Detail

done

public void done(TopicPartition topicPartition,
                 long baseOffset,
                 java.lang.RuntimeException error)
Mark this request as complete and unblock any threads waiting on its completion.

Parameters:
topicPartition - The topic and partition to which this record set was sent was sent
baseOffset - The base offset assigned to the record
error - The error that occurred if there was one, or null.

await

public void await()
           throws java.lang.InterruptedException
Await the completion of this request

Throws:
java.lang.InterruptedException

await

public boolean await(long timeout,
                     java.util.concurrent.TimeUnit unit)
              throws java.lang.InterruptedException
Await the completion of this request (up to the given time interval)

Parameters:
timeout - The maximum time to wait
unit - The unit for the max time
Returns:
true if the request completed, false if we timed out
Throws:
java.lang.InterruptedException

baseOffset

public long baseOffset()
The base offset for the request (the first offset in the record set)


error

public java.lang.RuntimeException error()
The error thrown (generally on the server) while processing this request


topicPartition

public TopicPartition topicPartition()
The topic and partition to which the record was appended


completed

public boolean completed()
Has the request completed?