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

8th
Jun 2016
Duncan Grist
@duncangrist
Jun 08 2016 16:30

Hello people.
I'm having issues getting my php application to gracefully handle the situation that a producer is unable to connect to any brokers. Of course it dies with CTRL+C, but it's vital for me to be able to detect this situation in PHP code, and handle the error there.

I can't seem to find any producer configuration settings which allow this, certainly setting message.send.max.retries to 1 doesn't seem to do anything - it just retries forever:

[dev@duncan event-bus-test-client]$ php publish-events.php
%3|1465403044.426|FAIL|rdkafka#producer-1| 127.0.0.1:43434/bootstrap: Connect to ipv4#127.0.0.1:43434 failed: Connection refused
%3|1465403045.446|FAIL|rdkafka#producer-1| 127.0.0.1:43434/bootstrap: Connect to ipv4#127.0.0.1:43434 failed: Connection refused
%3|1465403046.462|FAIL|rdkafka#producer-1| 127.0.0.1:43434/bootstrap: Connect to ipv4#127.0.0.1:43434 failed: Connection refused
%3|1465403047.478|FAIL|rdkafka#producer-1| 127.0.0.1:43434/bootstrap: Connect to ipv4#127.0.0.1:43434 failed: Connection refused
%3|1465403048.492|FAIL|rdkafka#producer-1| 127.0.0.1:43434/bootstrap: Connect to ipv4#127.0.0.1:43434 failed: Connection refused
%3|1465403049.508|FAIL|rdkafka#producer-1| 127.0.0.1:43434/bootstrap: Connect to ipv4#127.0.0.1:43434 failed: Connection refused
%3|1465403050.525|FAIL|rdkafka#producer-1| 127.0.0.1:43434/bootstrap: Connect to ipv4#127.0.0.1:43434 failed: Connection refused
^C
[dev@duncan event-bus-test-client]$
At the moment, the only thing I can think to do would be to create a custom queue application, run the producer inside that application and interface my wider php app with the custom queue application. Obviously this kinda reproduces what Kafka is trying to offer in the first place.