You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by mi...@apache.org on 2022/10/26 13:30:02 UTC
[incubator-eventmesh] branch master updated: Added logger to record the catched exception
This is an automated email from the ASF dual-hosted git repository.
mikexue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git
The following commit(s) were added to refs/heads/master by this push:
new 2dafa87f Added logger to record the catched exception
new 0ad19720 Merge pull request #1883 from rinuaby13/master
2dafa87f is described below
commit 2dafa87f7c7d19438cf8e323ac46acfc0a92b180
Author: rinuaby13 <ri...@gmail.com>
AuthorDate: Wed Oct 26 15:34:15 2022 +0530
Added logger to record the catched exception
---
.../org/apache/eventmesh/connector/kafka/consumer/ConsumerImpl.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/eventmesh-connector-plugin/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/consumer/ConsumerImpl.java b/eventmesh-connector-plugin/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/consumer/ConsumerImpl.java
index 88eef99e..9786a61c 100644
--- a/eventmesh-connector-plugin/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/consumer/ConsumerImpl.java
+++ b/eventmesh-connector-plugin/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/consumer/ConsumerImpl.java
@@ -38,7 +38,11 @@ import java.util.concurrent.atomic.AtomicBoolean;
import io.cloudevents.CloudEvent;
import io.cloudevents.kafka.CloudEventDeserializer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class ConsumerImpl {
+ public static final Logger logger = LoggerFactory.getLogger(ConsumerImpl.class);
private final KafkaConsumer<String, CloudEvent> kafkaConsumer;
private final Properties properties;
private AtomicBoolean started = new AtomicBoolean(false);
@@ -102,6 +106,7 @@ public class ConsumerImpl {
List<String> topics = new ArrayList<>(topicsSet);
this.kafkaConsumer.subscribe(topics);
} catch (Exception e) {
+ logger.error("Error while subscribing the Kafka consumer to topic: ",e);
throw new ConnectorRuntimeException(
String.format("Kafka consumer can't attach to %s.", topic));
}
@@ -115,6 +120,7 @@ public class ConsumerImpl {
List<String> topics = new ArrayList<>(topicsSet);
this.kafkaConsumer.subscribe(topics);
} catch (Exception e) {
+ logger.error("Error while unsubscribing the Kafka consumer: ",e);
throw new ConnectorRuntimeException(String.format("kafka push consumer fails to unsubscribe topic: %s", topic));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org