nerdexam
Confluent

CCDAK · Question #160

The producer code below features a 'Callback' class with a method called 'onCompletion()'. When will the 'onCompletion()' method be invoked?

The correct answer is D. When the producer receives the acknowledgment from the broker. The onCompletion() method of the Callback is invoked when the producer receives the acknowledgment from the broker, indicating that the message has been successfully written or an error has occurred.

Developing Kafka Producers

Question

The producer code below features a 'Callback' class with a method called 'onCompletion()'. When will the 'onCompletion()' method be invoked?

Exhibit

CCDAK question #160 exhibit

Options

  • AWhen a consumer sends an acknowledgement to the producer
  • BWhen the producer puts the message into its socket buffer
  • CWhen the producer batches the message
  • DWhen the producer receives the acknowledgment from the broker

How the community answered

(41 responses)
  • A
    7% (3)
  • B
    2% (1)
  • C
    2% (1)
  • D
    88% (36)

Explanation

The onCompletion() method of the Callback is invoked when the producer receives the acknowledgment from the broker, indicating that the message has been successfully written or an error has occurred.

Topics

#Callback#onCompletion#broker acknowledgment#async producer

Community Discussion

No community discussion yet for this question.

Full CCDAK Practice