Skip to content

Commit

Permalink
[ISSUE apache#5031] Http Connector Adaptation Work
Browse files Browse the repository at this point in the history
  • Loading branch information
cnzakii authored Jul 19, 2024
1 parent ec55804 commit 56f893c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import org.apache.eventmesh.connector.http.config.HttpServerConfig;
import org.apache.eventmesh.connector.http.sink.HttpSinkConnector;
import org.apache.eventmesh.connector.http.source.connector.HttpSourceConnector;
import org.apache.eventmesh.connector.http.source.HttpSourceConnector;
import org.apache.eventmesh.openconnect.Application;
import org.apache.eventmesh.openconnect.util.ConfigUtil;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.eventmesh.connector.http.sink.handle.HttpSinkHandler;
import org.apache.eventmesh.connector.http.sink.handle.RetryHttpSinkHandler;
import org.apache.eventmesh.connector.http.sink.handle.WebhookHttpSinkHandler;
import org.apache.eventmesh.openconnect.api.ConnectorCreateService;
import org.apache.eventmesh.openconnect.api.connector.ConnectorContext;
import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext;
import org.apache.eventmesh.openconnect.api.sink.Sink;
Expand All @@ -37,7 +38,7 @@
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class HttpSinkConnector implements Sink {
public class HttpSinkConnector implements Sink, ConnectorCreateService<Sink> {

private HttpSinkConfig httpSinkConfig;

Expand All @@ -49,6 +50,11 @@ public Class<? extends Config> configClass() {
return HttpSinkConfig.class;
}

@Override
public Sink create() {
return new HttpSinkConnector();
}

@Override
public void init(Config config) throws Exception {
this.httpSinkConfig = (HttpSinkConfig) config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
* limitations under the License.
*/

package org.apache.eventmesh.connector.http.source.connector;
package org.apache.eventmesh.connector.http.source;

import org.apache.eventmesh.common.config.connector.Config;
import org.apache.eventmesh.common.config.connector.http.HttpSourceConfig;
import org.apache.eventmesh.common.exception.EventMeshException;
import org.apache.eventmesh.connector.http.common.SynchronizedCircularFifoQueue;
import org.apache.eventmesh.connector.http.source.protocol.Protocol;
import org.apache.eventmesh.connector.http.source.protocol.ProtocolFactory;
import org.apache.eventmesh.openconnect.api.ConnectorCreateService;
import org.apache.eventmesh.openconnect.api.connector.ConnectorContext;
import org.apache.eventmesh.openconnect.api.connector.SourceConnectorContext;
import org.apache.eventmesh.openconnect.api.source.Source;
Expand All @@ -43,7 +44,7 @@
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class HttpSourceConnector implements Source {
public class HttpSourceConnector implements Source, ConnectorCreateService<Source> {

private HttpSourceConfig sourceConfig;

Expand Down Expand Up @@ -73,6 +74,11 @@ public Class<? extends Config> configClass() {
return HttpSourceConfig.class;
}

@Override
public Source create() {
return new HttpSourceConnector();
}

@Override
public void init(Config config) {
this.sourceConfig = (HttpSourceConfig) config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
* limitations under the License.
*/

package org.apache.eventmesh.connector.http.source.connector;
package org.apache.eventmesh.connector.http.sink;


import static org.mockserver.model.HttpRequest.request;

import org.apache.eventmesh.connector.http.sink.HttpSinkConnector;
import org.apache.eventmesh.connector.http.sink.config.HttpSinkConfig;
import org.apache.eventmesh.connector.http.sink.config.HttpWebhookConfig;
import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.eventmesh.connector.http.source.connector;
package org.apache.eventmesh.connector.http.source;


import org.apache.eventmesh.common.config.connector.http.HttpSourceConfig;
Expand Down

0 comments on commit 56f893c

Please sign in to comment.