These are chat archives for arnaud-lb/php-rdkafka

Aug 2018
Aug 07 2018 10:42 UTC

Hi all !
I want to send an array just with four fields, i am trying this way
$topic->produce(RD_KAFKA_PARTITION_UA, 0, $result[$i]);

But consumer cant see it and i have the warning:
PHP Warning: RdKafka\ProducerTopic::produce() expects parameter 3 to be string, array given in /var/www/html/new-tests/producer-new-test.php on line 28

Is there any other way to do this?
Or what am i doing wrong?
Thank you in advance

Aug 07 2018 10:44 UTC
$result[$i] contains array. It means that you have array of arrays.
you may use it that way
$topic->produce(RD_KAFKA_PARTITION_UA, 0, serialize($result[$i]));
and deserialize message in consumer
Aug 07 2018 11:03 UTC
@karavzeka thank you so much, It works !
I used unserialize() in consumer and everything is fine.