From 88df8a8a194238197b910b7ef8831f075d76d320 Mon Sep 17 00:00:00 2001 From: yangshengjie Date: Wed, 31 Aug 2022 21:41:37 +0800 Subject: [PATCH 1/2] [Feature][Connector-V2] Add sentry sink connector #2244 --- docs/en/connector-v2/sink/Sentry.md | 53 +++++++++++++ plugin-mapping.properties | 1 + seatunnel-connectors-v2-dist/pom.xml | 5 ++ .../connector-sentry/pom.xml | 58 ++++++++++++++ .../seatunnel/sentry/sink/SentryConfig.java | 32 ++++++++ .../seatunnel/sentry/sink/SentrySink.java | 73 ++++++++++++++++++ .../sentry/sink/SentrySinkState.java | 23 ++++++ .../sentry/sink/SentrySinkWriter.java | 77 +++++++++++++++++++ seatunnel-connectors-v2/pom.xml | 1 + .../pom.xml | 6 +- .../flink/v2/SeaTunnelSentryExample.java | 50 ++++++++++++ .../resources/examples/fake_to_sentry.conf | 59 ++++++++++++++ 12 files changed, 437 insertions(+), 1 deletion(-) create mode 100644 docs/en/connector-v2/sink/Sentry.md create mode 100644 seatunnel-connectors-v2/connector-sentry/pom.xml create mode 100644 seatunnel-connectors-v2/connector-sentry/src/main/java/org/apache/seatunnel/connectors/seatunnel/sentry/sink/SentryConfig.java create mode 100644 seatunnel-connectors-v2/connector-sentry/src/main/java/org/apache/seatunnel/connectors/seatunnel/sentry/sink/SentrySink.java create mode 100644 seatunnel-connectors-v2/connector-sentry/src/main/java/org/apache/seatunnel/connectors/seatunnel/sentry/sink/SentrySinkState.java create mode 100644 seatunnel-connectors-v2/connector-sentry/src/main/java/org/apache/seatunnel/connectors/seatunnel/sentry/sink/SentrySinkWriter.java create mode 100644 seatunnel-examples/seatunnel-flink-connector-v2-example/src/main/java/org/apache/seatunnel/example/flink/v2/SeaTunnelSentryExample.java create mode 100644 seatunnel-examples/seatunnel-flink-connector-v2-example/src/main/resources/examples/fake_to_sentry.conf diff --git a/docs/en/connector-v2/sink/Sentry.md b/docs/en/connector-v2/sink/Sentry.md new file mode 100644 index 00000000000..1a6241a3203 --- /dev/null +++ b/docs/en/connector-v2/sink/Sentry.md @@ -0,0 +1,53 @@ +# Sentry + +## Description + +Write message to Sentry. + +## Options + +| name | type | required | default value | +|----------------------------|---------|----------| ------------- | +| dsn | string | yes | - | +| env | string | no | - | +| release | string | no | - | +| cacheDirPath | string | no | - | +| enableExternalConfiguration | boolean | no | - | +| maxCacheItems | number | no | - | +| flushTimeoutMills | number | no | - | +| maxQueueSize | number | no | - | +### dsn [string] + +The DSN tells the SDK where to send the events to. + +### env [string] +specify the environment + +### release [string] +specify the release + +### cacheDirPath [string] +the cache dir path for caching offline events + +### enableExternalConfiguration [boolean] +if loading properties from external sources is enabled. + +### maxCacheItems [number] +The max cache items for capping the number of events Default is 30 + +### flushTimeoutMillis [number] +Controls how many seconds to wait before flushing down. Sentry SDKs cache events from a background queue and this queue is given a certain amount to drain pending events Default is 15000 = 15s + +### maxQueueSize [number] +Max queue size before flushing events/envelopes to the disk + +## Example +``` + Sentry { + dsn = "https://xxx@sentry.xxx.com:9999/6" + enableExternalConfiguration = true + maxCacheItems = 1000 + env = prod + } + +``` \ No newline at end of file diff --git a/plugin-mapping.properties b/plugin-mapping.properties index 51b7b9c3ebf..62119023d30 100644 --- a/plugin-mapping.properties +++ b/plugin-mapping.properties @@ -106,3 +106,4 @@ seatunnel.sink.HdfsFile = connector-file-hadoop seatunnel.sink.LocalFile = connector-file-local seatunnel.source.Pulsar = connector-pulsar seatunnel.source.Hudi = connector-hudi +seatunnel.sink.Sentry = connector-sentry diff --git a/seatunnel-connectors-v2-dist/pom.xml b/seatunnel-connectors-v2-dist/pom.xml index fe37965a1b8..02490560066 100644 --- a/seatunnel-connectors-v2-dist/pom.xml +++ b/seatunnel-connectors-v2-dist/pom.xml @@ -96,6 +96,11 @@ connector-hudi ${project.version} + + org.apache.seatunnel + connector-sentry + ${project.version} + diff --git a/seatunnel-connectors-v2/connector-sentry/pom.xml b/seatunnel-connectors-v2/connector-sentry/pom.xml new file mode 100644 index 00000000000..4c2c4e051a8 --- /dev/null +++ b/seatunnel-connectors-v2/connector-sentry/pom.xml @@ -0,0 +1,58 @@ + + + + + seatunnel-connectors-v2 + org.apache.seatunnel + ${revision} + + 4.0.0 + + connector-sentry + + + + org.apache.seatunnel + seatunnel-api + ${project.version} + + + + + + + + + io.sentry + sentry-logback + 5.0.1 + + + org.apache.seatunnel + connector-common + 2.1.3-SNAPSHOT + compile + + + + + \ No newline at end of file diff --git a/seatunnel-connectors-v2/connector-sentry/src/main/java/org/apache/seatunnel/connectors/seatunnel/sentry/sink/SentryConfig.java b/seatunnel-connectors-v2/connector-sentry/src/main/java/org/apache/seatunnel/connectors/seatunnel/sentry/sink/SentryConfig.java new file mode 100644 index 00000000000..421495b96ff --- /dev/null +++ b/seatunnel-connectors-v2/connector-sentry/src/main/java/org/apache/seatunnel/connectors/seatunnel/sentry/sink/SentryConfig.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.seatunnel.connectors.seatunnel.sentry.sink; + +public class SentryConfig { + + public static final String SENTRY = "sentry"; + public static final String DSN = "dsn"; + public static final String ENV = "env"; + public static final String RELEASE = "release"; + public static final String CACHE_DIRPATH = "cacheDirPath"; + public static final String ENABLE_EXTERNAL_CONFIGURATION = "enableExternalConfiguration"; + public static final String MAX_CACHEITEMS = "maxCacheItems"; + public static final String FLUSH_TIMEOUTMILLIS = "flushTimeoutMillis"; + public static final String MAX_QUEUESIZE = "maxQueueSize"; + +} diff --git a/seatunnel-connectors-v2/connector-sentry/src/main/java/org/apache/seatunnel/connectors/seatunnel/sentry/sink/SentrySink.java b/seatunnel-connectors-v2/connector-sentry/src/main/java/org/apache/seatunnel/connectors/seatunnel/sentry/sink/SentrySink.java new file mode 100644 index 00000000000..e4f1ada709e --- /dev/null +++ b/seatunnel-connectors-v2/connector-sentry/src/main/java/org/apache/seatunnel/connectors/seatunnel/sentry/sink/SentrySink.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.seatunnel.connectors.seatunnel.sentry.sink; + +import org.apache.seatunnel.api.common.PrepareFailException; +import org.apache.seatunnel.api.sink.SeaTunnelSink; +import org.apache.seatunnel.api.sink.SinkWriter.Context; +import org.apache.seatunnel.api.table.type.SeaTunnelDataType; +import org.apache.seatunnel.api.table.type.SeaTunnelRow; +import org.apache.seatunnel.api.table.type.SeaTunnelRowType; +import org.apache.seatunnel.common.constants.PluginType; +import org.apache.seatunnel.connectors.seatunnel.common.sink.AbstractSimpleSink; +import org.apache.seatunnel.connectors.seatunnel.common.sink.AbstractSinkWriter; + +import org.apache.seatunnel.shade.com.typesafe.config.Config; + +import com.google.auto.service.AutoService; + +import java.io.IOException; + +/** + * @description: SentrySink class + */ +@AutoService(SeaTunnelSink.class) +public class SentrySink extends AbstractSimpleSink { + + private SeaTunnelRowType seaTunnelRowType; + private Config pluginConfig; + @Override + public String getPluginName() { + return SentryConfig.SENTRY; + } + + @Override + public void prepare(Config pluginConfig) throws PrepareFailException { + if (!pluginConfig.hasPath(SentryConfig.DSN)) { + throw new PrepareFailException(getPluginName(), PluginType.SINK, + String.format("Config must include column : %s", SentryConfig.DSN)); + } + + this.pluginConfig = pluginConfig; + } + + @Override + public void setTypeInfo(SeaTunnelRowType seaTunnelRowType) { + this.seaTunnelRowType = seaTunnelRowType; + } + + @Override + public SeaTunnelDataType getConsumedType() { + return this.seaTunnelRowType; + } + + @Override + public AbstractSinkWriter createWriter(Context context) throws IOException { + return new SentrySinkWriter(seaTunnelRowType, context, pluginConfig); + } +} diff --git a/seatunnel-connectors-v2/connector-sentry/src/main/java/org/apache/seatunnel/connectors/seatunnel/sentry/sink/SentrySinkState.java b/seatunnel-connectors-v2/connector-sentry/src/main/java/org/apache/seatunnel/connectors/seatunnel/sentry/sink/SentrySinkState.java new file mode 100644 index 00000000000..b5ad101c326 --- /dev/null +++ b/seatunnel-connectors-v2/connector-sentry/src/main/java/org/apache/seatunnel/connectors/seatunnel/sentry/sink/SentrySinkState.java @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.seatunnel.connectors.seatunnel.sentry.sink; + +import java.io.Serializable; + +public class SentrySinkState implements Serializable { +} diff --git a/seatunnel-connectors-v2/connector-sentry/src/main/java/org/apache/seatunnel/connectors/seatunnel/sentry/sink/SentrySinkWriter.java b/seatunnel-connectors-v2/connector-sentry/src/main/java/org/apache/seatunnel/connectors/seatunnel/sentry/sink/SentrySinkWriter.java new file mode 100644 index 00000000000..4f94055bdfe --- /dev/null +++ b/seatunnel-connectors-v2/connector-sentry/src/main/java/org/apache/seatunnel/connectors/seatunnel/sentry/sink/SentrySinkWriter.java @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.seatunnel.connectors.seatunnel.sentry.sink; + +import org.apache.seatunnel.api.sink.SinkWriter; +import org.apache.seatunnel.api.table.type.SeaTunnelRow; +import org.apache.seatunnel.api.table.type.SeaTunnelRowType; +import org.apache.seatunnel.connectors.seatunnel.common.sink.AbstractSinkWriter; + +import org.apache.seatunnel.shade.com.typesafe.config.Config; + +import io.sentry.Sentry; +import io.sentry.SentryOptions; + +import java.io.IOException; + +/** + * @description: SentrySinkWriter class + */ + +public class SentrySinkWriter extends AbstractSinkWriter { + private SeaTunnelRowType seaTunnelRowType; + public SentrySinkWriter(SeaTunnelRowType seaTunnelRowType, + SinkWriter.Context context, + Config pluginConfig) { + SentryOptions options = new SentryOptions(); + options.setDsn(pluginConfig.getString(SentryConfig.DSN)); + if (pluginConfig.hasPath(SentryConfig.ENV)){ + options.setEnvironment(pluginConfig.getString(SentryConfig.ENV)); + } + if (pluginConfig.hasPath(SentryConfig.RELEASE)){ + options.setRelease(pluginConfig.getString(SentryConfig.RELEASE)); + } + if (pluginConfig.hasPath(SentryConfig.CACHE_DIRPATH)){ + options.setCacheDirPath(pluginConfig.getString(SentryConfig.CACHE_DIRPATH)); + } + if (pluginConfig.hasPath(SentryConfig.MAX_CACHEITEMS)){ + options.setMaxCacheItems(pluginConfig.getInt(SentryConfig.MAX_CACHEITEMS)); + } + if (pluginConfig.hasPath(SentryConfig.MAX_QUEUESIZE)){ + options.setMaxQueueSize(pluginConfig.getInt(SentryConfig.MAX_QUEUESIZE)); + } + if (pluginConfig.hasPath(SentryConfig.FLUSH_TIMEOUTMILLIS)){ + options.setFlushTimeoutMillis(pluginConfig.getLong(SentryConfig.FLUSH_TIMEOUTMILLIS)); + } + if (pluginConfig.hasPath(SentryConfig.ENABLE_EXTERNAL_CONFIGURATION)){ + options.setEnableExternalConfiguration(pluginConfig.getBoolean(SentryConfig.ENABLE_EXTERNAL_CONFIGURATION)); + } + Sentry.init(options); + } + + @Override + public void write(SeaTunnelRow element) throws IOException { + Sentry.captureMessage(element.toString()); + } + + @Override + public void close() throws IOException { + Sentry.close(); + } + +} diff --git a/seatunnel-connectors-v2/pom.xml b/seatunnel-connectors-v2/pom.xml index 42f67df2c9a..054b134e298 100644 --- a/seatunnel-connectors-v2/pom.xml +++ b/seatunnel-connectors-v2/pom.xml @@ -44,6 +44,7 @@ connector-file connector-hudi connector-assert + connector-sentry diff --git a/seatunnel-examples/seatunnel-flink-connector-v2-example/pom.xml b/seatunnel-examples/seatunnel-flink-connector-v2-example/pom.xml index 215a586f8a1..f55a755d520 100644 --- a/seatunnel-examples/seatunnel-flink-connector-v2-example/pom.xml +++ b/seatunnel-examples/seatunnel-flink-connector-v2-example/pom.xml @@ -67,7 +67,11 @@ ${project.version} - + + org.apache.seatunnel + connector-sentry + ${project.version} + org.apache.flink diff --git a/seatunnel-examples/seatunnel-flink-connector-v2-example/src/main/java/org/apache/seatunnel/example/flink/v2/SeaTunnelSentryExample.java b/seatunnel-examples/seatunnel-flink-connector-v2-example/src/main/java/org/apache/seatunnel/example/flink/v2/SeaTunnelSentryExample.java new file mode 100644 index 00000000000..7c0b1c5454f --- /dev/null +++ b/seatunnel-examples/seatunnel-flink-connector-v2-example/src/main/java/org/apache/seatunnel/example/flink/v2/SeaTunnelSentryExample.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.seatunnel.example.flink.v2; + +import org.apache.seatunnel.core.starter.Seatunnel; +import org.apache.seatunnel.core.starter.command.Command; +import org.apache.seatunnel.core.starter.exception.CommandException; +import org.apache.seatunnel.core.starter.flink.args.FlinkCommandArgs; +import org.apache.seatunnel.core.starter.flink.command.FlinkCommandBuilder; + +import java.io.FileNotFoundException; +import java.net.URISyntaxException; +import java.net.URL; +import java.nio.file.Paths; + +public class SeaTunnelSentryExample { + public static void main(String[] args) throws FileNotFoundException, URISyntaxException, CommandException { + String configFile = getTestConfigFile("/examples/fake_to_sentry.conf"); + FlinkCommandArgs flinkCommandArgs = new FlinkCommandArgs(); + flinkCommandArgs.setConfigFile(configFile); + flinkCommandArgs.setCheckConfig(false); + flinkCommandArgs.setVariables(null); + Command flinkCommand = + new FlinkCommandBuilder().buildCommand(flinkCommandArgs); + Seatunnel.run(flinkCommand); + } + + public static String getTestConfigFile(String configFile) throws FileNotFoundException, URISyntaxException { + URL resource = SeaTunnelSentryExample.class.getResource(configFile); + if (resource == null) { + throw new FileNotFoundException("Can't find config file: " + configFile); + } + return Paths.get(resource.toURI()).toString(); + } +} diff --git a/seatunnel-examples/seatunnel-flink-connector-v2-example/src/main/resources/examples/fake_to_sentry.conf b/seatunnel-examples/seatunnel-flink-connector-v2-example/src/main/resources/examples/fake_to_sentry.conf new file mode 100644 index 00000000000..be57175e42d --- /dev/null +++ b/seatunnel-examples/seatunnel-flink-connector-v2-example/src/main/resources/examples/fake_to_sentry.conf @@ -0,0 +1,59 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +###### +###### This config file is a demonstration of streaming processing in seatunnel config +###### + +env { + # You can set flink configuration here + execution.parallelism = 1 + #job.mode = "BATCH" + #execution.checkpoint.interval = 10000 + #execution.checkpoint.data-uri = "hdfs://localhost:9000/checkpoint" +} + +source { + # This is a example source plugin **only for test and demonstrate the feature source plugin** + FakeSource { + result_table_name = "fake" + field_name = "name,age" + } + + # If you would like to get more information about how to configure seatunnel and see full list of source plugins, + # please go to https://seatunnel.apache.org/docs/flink/configuration/source-plugins/Fake +} + +transform { + sql { + sql = "select name,age from fake" + } + + # If you would like to get more information about how to configure seatunnel and see full list of transform plugins, + # please go to https://seatunnel.apache.org/docs/flink/configuration/transform-plugins/Sql +} + +sink { + Sentry { + dsn = "https://xxx@sentry.xxx.com:9999/6" + enableExternalConfiguration = true + maxCacheItems = 1000 + env = test + } + + # If you would like to get more information about how to configure seatunnel and see full list of sink plugins, + # please go to https://seatunnel.apache.org/docs/flink/configuration/sink-plugins/Console +} \ No newline at end of file From 3979cf6755d9544a31a5688de73b2ca1db6cbaae Mon Sep 17 00:00:00 2001 From: yangshengjie Date: Thu, 1 Sep 2022 10:20:53 +0800 Subject: [PATCH 2/2] [Feature][Connector-V2] Add sentry sink connector: modify pom.xml and doc, remove example class --- docs/en/connector-v2/sink/Sentry.md | 6 ++ .../connector-sentry/pom.xml | 15 ++--- .../pom.xml | 5 -- .../flink/v2/SeaTunnelSentryExample.java | 50 ---------------- .../resources/examples/fake_to_sentry.conf | 59 ------------------- 5 files changed, 12 insertions(+), 123 deletions(-) delete mode 100644 seatunnel-examples/seatunnel-flink-connector-v2-example/src/main/java/org/apache/seatunnel/example/flink/v2/SeaTunnelSentryExample.java delete mode 100644 seatunnel-examples/seatunnel-flink-connector-v2-example/src/main/resources/examples/fake_to_sentry.conf diff --git a/docs/en/connector-v2/sink/Sentry.md b/docs/en/connector-v2/sink/Sentry.md index 1a6241a3203..1e64e8aaba1 100644 --- a/docs/en/connector-v2/sink/Sentry.md +++ b/docs/en/connector-v2/sink/Sentry.md @@ -4,6 +4,12 @@ Write message to Sentry. +## Key features + +- [ ] [exactly-once](../../concept/connector-v2-features.md) +- [ ] [schema projection](../../concept/connector-v2-features.md) + + ## Options | name | type | required | default value | diff --git a/seatunnel-connectors-v2/connector-sentry/pom.xml b/seatunnel-connectors-v2/connector-sentry/pom.xml index 4c2c4e051a8..c2234a66ea9 100644 --- a/seatunnel-connectors-v2/connector-sentry/pom.xml +++ b/seatunnel-connectors-v2/connector-sentry/pom.xml @@ -29,28 +29,25 @@ connector-sentry + + 5.0.1 + + org.apache.seatunnel seatunnel-api ${project.version} - - - - - - io.sentry sentry-logback - 5.0.1 + ${sentry.version} org.apache.seatunnel connector-common - 2.1.3-SNAPSHOT - compile + ${project.version} diff --git a/seatunnel-examples/seatunnel-flink-connector-v2-example/pom.xml b/seatunnel-examples/seatunnel-flink-connector-v2-example/pom.xml index c90995f2415..d52f99dbdf9 100644 --- a/seatunnel-examples/seatunnel-flink-connector-v2-example/pom.xml +++ b/seatunnel-examples/seatunnel-flink-connector-v2-example/pom.xml @@ -82,11 +82,6 @@ ${project.version} - - org.apache.seatunnel - connector-sentry - ${project.version} - org.apache.flink diff --git a/seatunnel-examples/seatunnel-flink-connector-v2-example/src/main/java/org/apache/seatunnel/example/flink/v2/SeaTunnelSentryExample.java b/seatunnel-examples/seatunnel-flink-connector-v2-example/src/main/java/org/apache/seatunnel/example/flink/v2/SeaTunnelSentryExample.java deleted file mode 100644 index 7c0b1c5454f..00000000000 --- a/seatunnel-examples/seatunnel-flink-connector-v2-example/src/main/java/org/apache/seatunnel/example/flink/v2/SeaTunnelSentryExample.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.seatunnel.example.flink.v2; - -import org.apache.seatunnel.core.starter.Seatunnel; -import org.apache.seatunnel.core.starter.command.Command; -import org.apache.seatunnel.core.starter.exception.CommandException; -import org.apache.seatunnel.core.starter.flink.args.FlinkCommandArgs; -import org.apache.seatunnel.core.starter.flink.command.FlinkCommandBuilder; - -import java.io.FileNotFoundException; -import java.net.URISyntaxException; -import java.net.URL; -import java.nio.file.Paths; - -public class SeaTunnelSentryExample { - public static void main(String[] args) throws FileNotFoundException, URISyntaxException, CommandException { - String configFile = getTestConfigFile("/examples/fake_to_sentry.conf"); - FlinkCommandArgs flinkCommandArgs = new FlinkCommandArgs(); - flinkCommandArgs.setConfigFile(configFile); - flinkCommandArgs.setCheckConfig(false); - flinkCommandArgs.setVariables(null); - Command flinkCommand = - new FlinkCommandBuilder().buildCommand(flinkCommandArgs); - Seatunnel.run(flinkCommand); - } - - public static String getTestConfigFile(String configFile) throws FileNotFoundException, URISyntaxException { - URL resource = SeaTunnelSentryExample.class.getResource(configFile); - if (resource == null) { - throw new FileNotFoundException("Can't find config file: " + configFile); - } - return Paths.get(resource.toURI()).toString(); - } -} diff --git a/seatunnel-examples/seatunnel-flink-connector-v2-example/src/main/resources/examples/fake_to_sentry.conf b/seatunnel-examples/seatunnel-flink-connector-v2-example/src/main/resources/examples/fake_to_sentry.conf deleted file mode 100644 index be57175e42d..00000000000 --- a/seatunnel-examples/seatunnel-flink-connector-v2-example/src/main/resources/examples/fake_to_sentry.conf +++ /dev/null @@ -1,59 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -###### -###### This config file is a demonstration of streaming processing in seatunnel config -###### - -env { - # You can set flink configuration here - execution.parallelism = 1 - #job.mode = "BATCH" - #execution.checkpoint.interval = 10000 - #execution.checkpoint.data-uri = "hdfs://localhost:9000/checkpoint" -} - -source { - # This is a example source plugin **only for test and demonstrate the feature source plugin** - FakeSource { - result_table_name = "fake" - field_name = "name,age" - } - - # If you would like to get more information about how to configure seatunnel and see full list of source plugins, - # please go to https://seatunnel.apache.org/docs/flink/configuration/source-plugins/Fake -} - -transform { - sql { - sql = "select name,age from fake" - } - - # If you would like to get more information about how to configure seatunnel and see full list of transform plugins, - # please go to https://seatunnel.apache.org/docs/flink/configuration/transform-plugins/Sql -} - -sink { - Sentry { - dsn = "https://xxx@sentry.xxx.com:9999/6" - enableExternalConfiguration = true - maxCacheItems = 1000 - env = test - } - - # If you would like to get more information about how to configure seatunnel and see full list of sink plugins, - # please go to https://seatunnel.apache.org/docs/flink/configuration/sink-plugins/Console -} \ No newline at end of file