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

[Fix][Kafka-Sink] fix kafka sink factory option rule #6657

Merged
merged 3 commits into from
Apr 12, 2024
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@
import org.apache.seatunnel.api.table.factory.TableSinkFactory;
import org.apache.seatunnel.api.table.factory.TableSinkFactoryContext;
import org.apache.seatunnel.connectors.seatunnel.kafka.config.Config;
import org.apache.seatunnel.connectors.seatunnel.kafka.config.MessageFormat;

import com.google.auto.service.AutoService;

import java.util.Arrays;

@AutoService(Factory.class)
public class KafkaSinkFactory implements TableSinkFactory {
@Override
Expand All @@ -39,17 +36,9 @@ public String factoryIdentifier() {
@Override
public OptionRule optionRule() {
return OptionRule.builder()
.required(Config.FORMAT, Config.BOOTSTRAP_SERVERS)
.conditional(
Copy link
Member

Choose a reason for hiding this comment

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

Why remove this? conditional option can help SeaTunnel Web auto create connector form.

Copy link
Member Author

Choose a reason for hiding this comment

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

because i find this rule is only check topic parameter exist when format is in (json, cancal_json, text, ....), but it required whether the format is. so i remove it.
if the web need use this, i will add this conditional option back.

Copy link
Member Author

Choose a reason for hiding this comment

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

Why remove this? conditional option can help SeaTunnel Web auto create connector form.

@Hisoka-X i remove it before, but eric said it will be used in web. so i put it back and move the topic option check in conditional, just put it to required

Config.FORMAT,
Arrays.asList(
MessageFormat.JSON,
MessageFormat.CANAL_JSON,
MessageFormat.TEXT,
MessageFormat.OGG_JSON,
MessageFormat.AVRO),
Config.TOPIC)
.required(Config.TOPIC, Config.BOOTSTRAP_SERVERS)
.optional(
Config.FORMAT,
Config.KAFKA_CONFIG,
Config.ASSIGN_PARTITIONS,
Config.TRANSACTION_PREFIX,
Expand Down
Loading