Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature][Connector-V2] Socket Connector Sink #2549

Merged
merged 4 commits into from
Aug 28, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion seatunnel-connectors-v2/connector-socket/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<dependency>
<groupId>org.apache.seatunnel</groupId>
<artifactId>seatunnel-format-json</artifactId>
<version>2.1.3-SNAPSHOT</version>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@

@Data
public class SinkConfig implements Serializable {
public static final String HOST = "host";
public static final String PORT = "port";
private static final String MAX_RETRIES = "max_retries";
private static final int DEFAULT_MAX_RETRIES = 3;
public static final String HOST = "host";
public static final String PORT = "port";
private static final String MAX_RETRIES = "max_retries";
private static final int DEFAULT_MAX_RETRIES = 3;
private String host;
private Integer port;
private int port;
private Integer maxNumRetries = DEFAULT_MAX_RETRIES;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same as port

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for your advice. I have fixed the problems mentioned above


public SinkConfig(Config config) {
this.host = config.getString(HOST);
this.port = config.getInt(PORT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class SocketSink extends AbstractSimpleSink<SeaTunnelRow, Void> {
private Config pluginConfig;
private SinkConfig sinkConfig;
private SeaTunnelRowType seaTunnelRowType;
531651225 marked this conversation as resolved.
Show resolved Hide resolved

@Override
public String getPluginName() {
return "Socket";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@

public class SocketSinkWriter extends AbstractSinkWriter<SeaTunnelRow, Void> {
private final SocketClient socketClient;

protected final SerializationSchema serializationSchema;

private final SerializationSchema serializationSchema;
private final SinkConfig sinkConfig;

SocketSinkWriter(SinkConfig sinkConfig, SeaTunnelRowType seaTunnelRowType) throws IOException {
this.sinkConfig = sinkConfig;
this.serializationSchema = new JsonSerializationSchema(seaTunnelRowType);
Expand All @@ -48,5 +47,4 @@ public void write(SeaTunnelRow element) throws IOException {
public void close() throws IOException {
socketClient.close();
}

}