diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SinkWorker.java b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SinkWorker.java index b23b402c87..6cdaa629a0 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SinkWorker.java +++ b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SinkWorker.java @@ -89,8 +89,8 @@ public void start() { try { sink.start(); } catch (Exception e) { - e.printStackTrace(); - log.error(e.getMessage()); + log.error("sink worker[{}] start fail", sink.name(), e); + return; } eventMeshTCPClient.subscribe(config.getPubSubConfig().getSubject(), SubscriptionMode.CLUSTERING, SubscriptionType.ASYNC); @@ -105,7 +105,6 @@ public void stop() { eventMeshTCPClient.unsubscribe(); eventMeshTCPClient.close(); } catch (Exception e) { - e.printStackTrace(); log.error("event mesh client close", e); } try { @@ -113,11 +112,11 @@ public void stop() { } catch (Exception e) { log.error("sink destroy error", e); } - log.info("source worker stopped"); } static class EventHandler implements ReceiveMsgHook { + private final Sink sink; public EventHandler(Sink sink) { diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SourceWorker.java b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SourceWorker.java index e4baff9ba8..b479aa9829 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SourceWorker.java +++ b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SourceWorker.java @@ -101,11 +101,10 @@ public void start() { eventMeshTCPClient.publish(event, 3000); } } + log.info("source worker[{}] started", source.name()); } catch (Exception e) { - e.printStackTrace(); - log.error(e.getMessage()); + log.error("source worker[{}] start fail", source.name(), e); } - log.info("source worker started"); } private CloudEvent convertRecordToEvent(ConnectRecord connectRecord) {