RdKafka::flush

(PECL rdkafka >= 4.0.0, librdkafka >= 0.11.0)

RdKafka::flushWait until all outstanding produce requests, et.al, are completed.

Description

public RdKafka::flush ( integer $timeout_ms ) : integer

Wait until all outstanding produce requests, et.al, are completed. This should typically be done prior to destroying a producer instance to make sure all queued and in-flight produce requests are completed before terminating. This function will call poll() and thus trigger callbacks.

Parameters

timeout_ms (integer)

Specifies the maximum amount of time (in milliseconds) that the call will block. To wait indefinitely provide -1.

Return Values

In case of success returns RD_KAFKA_RESP_ERR_NO_ERROR, in case of timeout RD_KAFKA_RESP_ERR__TIMED_OUT and if not called on a producer instance RD_KAFKA_RESP_ERR__NOT_IMPLEMENTED.