This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 8aec25190b [type:fix] Set up callback for send message on Kafka (#5748)
8aec25190b is described below
commit 8aec25190bb6ee91f07b77b68b3a4865241946b3
Author: eye-gu <[email protected]>
AuthorDate: Mon Nov 4 14:37:09 2024 +0800
[type:fix] Set up callback for send message on Kafka (#5748)
---
.../shenyu/plugin/logging/kafka/client/KafkaLogCollectClient.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-kafka/src/main/java/org/apache/shenyu/plugin/logging/kafka/client/KafkaLogCollectClient.java
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-kafka/src/main/java/org/apache/shenyu/plugin/logging/kafka/client/KafkaLogCollectClient.java
index 216157da32..2747619b1f 100644
---
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-kafka/src/main/java/org/apache/shenyu/plugin/logging/kafka/client/KafkaLogCollectClient.java
+++
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-kafka/src/main/java/org/apache/shenyu/plugin/logging/kafka/client/KafkaLogCollectClient.java
@@ -122,7 +122,11 @@ public class KafkaLogCollectClient extends
AbstractLogConsumeClient<KafkaLogColl
.map(apiConfig ->
StringUtils.defaultIfBlank(apiConfig.getTopic(), topic)
).orElse(topic);
try {
- producer.send(toProducerRecord(logTopic, log));
+ producer.send(toProducerRecord(logTopic, log), (metadata,
exception) -> {
+ if (Objects.nonNull(exception)) {
+ LOG.error("kafka push logs error", exception);
+ }
+ });
} catch (Exception e) {
LOG.error("kafka push logs error", e);
}