Skip to content

Commit c1e1e3a

Browse files
authored
feat: propagate result code on Producer::flushMessages err (#183)
1 parent 03b58f1 commit c1e1e3a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Clients/Producer/KafkaProducer.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use RdKafka\ProducerTopic;
1010
use RuntimeException;
1111

12+
use function assert;
1213
use function sprintf;
1314

1415
use const RD_KAFKA_PARTITION_UA;
@@ -76,8 +77,10 @@ public function flushMessages(int $timeoutMs = 10000): void
7677
}
7778
}
7879

80+
assert($result !== null);
81+
7982
if ($result !== RD_KAFKA_RESP_ERR_NO_ERROR) {
80-
throw new RuntimeException('Was unable to flush, messages might be lost!');
83+
throw new RuntimeException('Was unable to flush, messages might be lost!', $result);
8184
}
8285
}
8386
}

0 commit comments

Comments
 (0)