@@ -402,15 +402,16 @@ PHP_METHOD(RdKafka__ProducerTopic, produce)
402
402
/* }}} */
403
403
404
404
#ifdef HAVE_RD_KAFKA_MESSAGE_HEADERS
405
- /* {{{ proto void RdKafka\ProducerTopic::producev(int $partition, int $msgflags[, string $payload, string $key, array $headers])
406
- Produce and send a single message to broker (with headers possibility). */
405
+ /* {{{ proto void RdKafka\ProducerTopic::producev(int $partition, int $msgflags[, string $payload, string $key, array $headers, int $timestamp_ms ])
406
+ Produce and send a single message to broker (with headers possibility and timestamp ). */
407
407
408
408
ZEND_BEGIN_ARG_INFO_EX (arginfo_kafka_producev , 0 , 0 , 2 )
409
409
ZEND_ARG_INFO (0 , partition )
410
410
ZEND_ARG_INFO (0 , msgflags )
411
411
ZEND_ARG_INFO (0 , payload )
412
412
ZEND_ARG_INFO (0 , key )
413
413
ZEND_ARG_INFO (0 , headers )
414
+ ZEND_ARG_INFO (0 , timestamp_ms )
414
415
ZEND_END_ARG_INFO ()
415
416
416
417
PHP_METHOD (RdKafka__ProducerTopic , producev )
@@ -429,8 +430,10 @@ PHP_METHOD(RdKafka__ProducerTopic, producev)
429
430
char * header_key ;
430
431
zeval * header_value ;
431
432
rd_kafka_headers_t * headers ;
433
+ long timestamp_ms = 0 ;
434
+ zend_bool timestamp_ms_is_null = 0 ;
432
435
433
- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "ll|s!s!h!" , & partition , & msgflags , & payload , & payload_len , & key , & key_len , & headersParam ) == FAILURE ) {
436
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "ll|s!s!h!l! " , & partition , & msgflags , & payload , & payload_len , & key , & key_len , & headersParam , & timestamp_ms , & timestamp_ms_is_null ) == FAILURE ) {
434
437
return ;
435
438
}
436
439
@@ -444,6 +447,10 @@ PHP_METHOD(RdKafka__ProducerTopic, producev)
444
447
return ;
445
448
}
446
449
450
+ if (timestamp_ms_is_null == 1 ) {
451
+ timestamp_ms = 0 ;
452
+ }
453
+
447
454
intern = get_kafka_topic_object (getThis () TSRMLS_CC );
448
455
449
456
if (headersParam != NULL && zend_hash_num_elements (headersParam ) > 0 ) {
@@ -477,6 +484,7 @@ PHP_METHOD(RdKafka__ProducerTopic, producev)
477
484
RD_KAFKA_V_MSGFLAGS (msgflags | RD_KAFKA_MSG_F_COPY ),
478
485
RD_KAFKA_V_VALUE (payload , payload_len ),
479
486
RD_KAFKA_V_KEY (key , key_len ),
487
+ RD_KAFKA_V_TIMESTAMP (timestamp_ms ),
480
488
RD_KAFKA_V_HEADERS (headers ),
481
489
RD_KAFKA_V_END
482
490
);
0 commit comments