Class Sender
java.lang.Object
org.apache.kafka.clients.producer.internals.Sender
- All Implemented Interfaces:
Runnable
The background thread that handles the sending of produce requests to the Kafka cluster. This thread makes metadata
requests to renew its view of the cluster and then sends produce requests to the appropriate nodes.
-
Constructor Summary
ConstructorsConstructorDescriptionSender(org.apache.kafka.common.utils.LogContext logContext, org.apache.kafka.clients.KafkaClient client, ProducerMetadata metadata, RecordAccumulator accumulator, boolean guaranteeMessageOrder, int maxRequestSize, short acks, int retries, SenderMetricsRegistry metricsRegistry, org.apache.kafka.common.utils.Time time, int requestTimeoutMs, long retryBackoffMs, TransactionManager transactionManager, org.apache.kafka.clients.ApiVersions apiVersions) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToInflightBatches(Map<Integer, List<ProducerBatch>> batches) voidCloses the sender without sending out any pending messages.inFlightBatches(org.apache.kafka.common.TopicPartition tp) voidStart closing the sender (won't actually complete until all data is sent out)booleanvoidrun()The main run loop for the sender threadstatic org.apache.kafka.common.metrics.SensorthrottleTimeSensor(SenderMetricsRegistry metrics) voidwakeup()Wake up the selector associated with this send thread
-
Constructor Details
-
Sender
public Sender(org.apache.kafka.common.utils.LogContext logContext, org.apache.kafka.clients.KafkaClient client, ProducerMetadata metadata, RecordAccumulator accumulator, boolean guaranteeMessageOrder, int maxRequestSize, short acks, int retries, SenderMetricsRegistry metricsRegistry, org.apache.kafka.common.utils.Time time, int requestTimeoutMs, long retryBackoffMs, TransactionManager transactionManager, org.apache.kafka.clients.ApiVersions apiVersions)
-
-
Method Details
-
inFlightBatches
-
addToInflightBatches
-
run
public void run()The main run loop for the sender thread -
initiateClose
public void initiateClose()Start closing the sender (won't actually complete until all data is sent out) -
forceClose
public void forceClose()Closes the sender without sending out any pending messages. -
isRunning
public boolean isRunning() -
wakeup
public void wakeup()Wake up the selector associated with this send thread -
throttleTimeSensor
public static org.apache.kafka.common.metrics.Sensor throttleTimeSensor(SenderMetricsRegistry metrics)
-