|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | + * contributor license agreements. See the NOTICE file distributed with |
| 4 | + * this work for additional information regarding copyright ownership. |
| 5 | + * The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | + * (the "License"); you may not use this file except in compliance with |
| 7 | + * the License. You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | + |
| 18 | +package org.apache.seatunnel.connectors.seatunnel.cdc.mysql.source; |
| 19 | + |
| 20 | +import org.apache.seatunnel.api.configuration.util.OptionRule; |
| 21 | +import org.apache.seatunnel.api.table.factory.Factory; |
| 22 | +import org.apache.seatunnel.api.table.factory.TableSourceFactory; |
| 23 | +import org.apache.seatunnel.connectors.cdc.base.option.JdbcSourceOptions; |
| 24 | +import org.apache.seatunnel.connectors.seatunnel.jdbc.catalog.JdbcCatalogOptions; |
| 25 | + |
| 26 | +import com.google.auto.service.AutoService; |
| 27 | + |
| 28 | +@AutoService(Factory.class) |
| 29 | +public class MySqlIncrementalSourceFactory implements TableSourceFactory { |
| 30 | + @Override |
| 31 | + public String factoryIdentifier() { |
| 32 | + return MySqlIncrementalSource.IDENTIFIER; |
| 33 | + } |
| 34 | + |
| 35 | + @Override |
| 36 | + public OptionRule optionRule() { |
| 37 | + return JdbcSourceOptions.BASE_RULE |
| 38 | + .required( |
| 39 | + JdbcSourceOptions.HOSTNAME, |
| 40 | + JdbcSourceOptions.USERNAME, |
| 41 | + JdbcSourceOptions.PASSWORD, |
| 42 | + JdbcSourceOptions.DATABASE_NAME, |
| 43 | + JdbcSourceOptions.TABLE_NAME, |
| 44 | + JdbcCatalogOptions.BASE_URL) |
| 45 | + .optional( |
| 46 | + JdbcSourceOptions.PORT, |
| 47 | + JdbcSourceOptions.SERVER_ID, |
| 48 | + JdbcSourceOptions.SERVER_TIME_ZONE, |
| 49 | + JdbcSourceOptions.CONNECT_TIMEOUT_MS, |
| 50 | + JdbcSourceOptions.CONNECT_MAX_RETRIES, |
| 51 | + JdbcSourceOptions.CONNECTION_POOL_SIZE) |
| 52 | + .build(); |
| 53 | + } |
| 54 | +} |
0 commit comments