You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/handle/CommonHttpSinkHandler.java
+16-7
Original file line number
Diff line number
Diff line change
@@ -133,7 +133,14 @@ public Future<HttpResponse<Buffer>> deliver(URI url, HttpConnectRecord httpConne
Copy file name to clipboardExpand all lines: eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/handle/WebhookHttpSinkHandler.java
+30-8
Original file line number
Diff line number
Diff line change
@@ -72,6 +72,18 @@ public class WebhookHttpSinkHandler extends CommonHttpSinkHandler {
72
72
// store the received data, when webhook is enabled
Copy file name to clipboardExpand all lines: eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/source/connector/HttpSourceConnector.java
+34-7
Original file line number
Diff line number
Diff line change
@@ -55,6 +55,18 @@ public class HttpSourceConnector implements Source {
55
55
56
56
privateHttpServerserver;
57
57
58
+
privatevolatilebooleanstarted = false;
59
+
60
+
privatevolatilebooleandestroyed = false;
61
+
62
+
publicbooleanisStarted() {
63
+
returnstarted;
64
+
}
65
+
66
+
publicbooleanisDestroyed() {
67
+
returndestroyed;
68
+
}
69
+
58
70
59
71
@Override
60
72
publicClass<? extendsConfig> configClass() {
@@ -105,10 +117,15 @@ private void doInit() {
105
117
106
118
@Override
107
119
publicvoidstart() {
108
-
Throwablet = this.server.listen().cause();
109
-
if (t != null) {
110
-
thrownewEventMeshException("failed to start Vertx server", t);
111
-
}
120
+
this.server.listen(res -> {
121
+
if (res.succeeded()) {
122
+
this.started = true;
123
+
log.info("HttpSourceConnector started on port: {}", this.sourceConfig.getConnectorConfig().getPort());
124
+
} else {
125
+
log.error("HttpSourceConnector failed to start on port: {}", this.sourceConfig.getConnectorConfig().getPort());
126
+
thrownewEventMeshException("failed to start Vertx server", res.cause());
127
+
}
128
+
});
112
129
}
113
130
114
131
@Override
@@ -123,9 +140,19 @@ public String name() {
123
140
124
141
@Override
125
142
publicvoidstop() {
126
-
Throwablet = this.server.close().cause();
127
-
if (t != null) {
128
-
thrownewEventMeshException("failed to stop Vertx server", t);
143
+
if (this.server != null) {
144
+
this.server.close(res -> {
145
+
if (res.succeeded()) {
146
+
this.destroyed = true;
147
+
log.info("HttpSourceConnector stopped on port: {}", this.sourceConfig.getConnectorConfig().getPort());
148
+
} else {
149
+
log.error("HttpSourceConnector failed to stop on port: {}", this.sourceConfig.getConnectorConfig().getPort());
150
+
thrownewEventMeshException("failed to stop Vertx server", res.cause());
151
+
}
152
+
}
153
+
);
154
+
} else {
155
+
log.warn("HttpSourceConnector server is null, ignore.");
Copy file name to clipboardExpand all lines: eventmesh-connectors/eventmesh-connector-http/src/test/java/org/apache/eventmesh/connector/http/source/connector/HttpSinkConnectorTest.java
0 commit comments