You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by sh...@apache.org on 2023/06/09 12:14:14 UTC
[rocketmq-eventbridge] branch runtimer updated (001776c -> d03c361)
This is an automated email from the ASF dual-hosted git repository.
shenlin pushed a change to branch runtimer
in repository https://gitbox.apache.org/repos/asf/rocketmq-eventbridge.git
from 001776c adjust logic
new 62b6c05 1.add embedded database 2.add default validateFilter
new b634ba9 1.add h2 db migration file directory
new 9d7b87e 1.add readme 2.modify ValidateFilter, add default filter
new d03c361 1.merge h2-migration and migration
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
adapter/persistence/pom.xml | 5 +
.../adapter/persistence/DatasourceConfig.java | 110 +++++++++++++++++++++
.../adapter/persistence/PersistenceConfig.java | 2 -
.../MybatisEventTargetRunnerRepository.java | 5 +
.../main/resources/db/migration/V1__baseline.sql | 76 +++++++-------
.../main/resources/db/migration/V2__baseline.sql | 42 ++++----
.../migration/V3__change_target_transform_type.sql | 30 +++---
.../db/migration/V4__register_source_acs_mns.sql | 30 +++---
.../migration/V5__register_target_acs_dingtalk.sql | 30 +++---
.../V6__register_target_acs_eventbridge.sql | 30 +++---
...V7__update_event_connection_table_structure.sql | 35 +++----
.../db/migration/V8__update_unique_key.sql | 40 ++++----
.../rocketmq/impl/RocketMQEventDataRepository.java | 6 +-
.../eventbridge/enums/props/Constants.java | 24 +++--
.../ServiceProviderNotFoundException.java} | 27 ++---
docs/cn/RocketMQEventBridgeDatabaseUsage.md | 29 ++++++
docs/cn/RocketMQEventBridgeRuleValidation.md | 44 +++++++++
docs/cn/images/h2.png | Bin 0 -> 188366 bytes
infrastructure/pom.xml | 11 +++
.../infrastructure/validate/AuthValidation.java | 25 +++--
.../validate/DefaultAuthValidation.java | 47 +++++++++
.../validate/spi/ServiceLifecycle.java | 31 ++++++
.../validate/spi/ValidationServiceFactory.java | 47 +++++++++
.../validate/spi/ValidationServiceLoader.java | 91 +++++++++++++++++
.../validate/spi/annotation/SingletonSPI.java | 11 ++-
.../validate/spi/typed/TypedSPI.java | 28 ++++--
.../validate/spi/typed/TypedSPIRegistry.java | 79 +++++++++++++++
...ntbridge.infrastructure.validate.AuthValidation | 6 +-
.../eventbridge/config/H2ServerConfig.java | 31 +++---
.../rocketmq/eventbridge/filter/LoginFilter.java | 26 ++---
.../eventbridge/filter/ValidateFilter.java | 69 +++++++++++++
start/src/main/resources/application.properties | 10 +-
32 files changed, 841 insertions(+), 236 deletions(-)
create mode 100644 adapter/persistence/src/main/java/org/apache/rocketmq/eventbridge/adapter/persistence/DatasourceConfig.java
copy adapter/rpc/src/main/java/org/apache/rocketmq/eventbridge/adapter/rpc/impl/connect/dto/TransformRequest.java => common/src/main/java/org/apache/rocketmq/eventbridge/enums/props/Constants.java (67%)
copy common/src/{test/java/org/apache/rocketmq/eventbridge/tools/transform/OriginalTransformTest.java => main/java/org/apache/rocketmq/eventbridge/exception/ServiceProviderNotFoundException.java} (60%)
create mode 100644 docs/cn/RocketMQEventBridgeDatabaseUsage.md
create mode 100644 docs/cn/RocketMQEventBridgeRuleValidation.md
create mode 100644 docs/cn/images/h2.png
copy adapter/rpc/src/main/java/org/apache/rocketmq/eventbridge/adapter/rpc/impl/network/NetworkServiceAPIImpl.java => infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/AuthValidation.java (60%)
create mode 100644 infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/DefaultAuthValidation.java
create mode 100644 infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/ServiceLifecycle.java
create mode 100644 infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/ValidationServiceFactory.java
create mode 100644 infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/ValidationServiceLoader.java
copy adapter/api/src/main/java/org/apache/rocketmq/eventbridge/adapter/api/annotations/WebLog.java => infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/annotation/SingletonSPI.java (84%)
copy common/src/main/java/org/apache/rocketmq/eventbridge/tools/pattern/PatternType.java => infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/typed/TypedSPI.java (65%)
create mode 100644 infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/typed/TypedSPIRegistry.java
copy adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql => infrastructure/src/main/resources/META-INF/services/org.apache.rocketmq.eventbridge.infrastructure.validate.AuthValidation (87%)
copy common/src/main/java/org/apache/rocketmq/eventbridge/config/AppConfig.java => start/src/main/java/org/apache/rocketmq/eventbridge/config/H2ServerConfig.java (52%)
create mode 100644 start/src/main/java/org/apache/rocketmq/eventbridge/filter/ValidateFilter.java
[rocketmq-eventbridge] 01/04: 1.add embedded database 2.add default validateFilter
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
shenlin pushed a commit to branch runtimer
in repository https://gitbox.apache.org/repos/asf/rocketmq-eventbridge.git
commit 62b6c05070b4aff32272f0f727746cd8c1f778e0
Author: wangkai <wa...@zhongan.com>
AuthorDate: Mon May 22 17:32:06 2023 +0800
1.add embedded database
2.add default validateFilter
---
adapter/persistence/pom.xml | 5 +
.../adapter/persistence/DatasourceConfig.java | 110 +++++++++++++++++++++
.../adapter/persistence/PersistenceConfig.java | 2 -
.../MybatisEventTargetRunnerRepository.java | 5 +
.../main/resources/db/migration/V1__baseline.sql | 76 +++++++-------
.../main/resources/db/migration/V2__baseline.sql | 38 +++----
.../migration/V3__change_target_transform_type.sql | 30 +++---
.../db/migration/V4__register_source_acs_mns.sql | 30 +++---
.../migration/V5__register_target_acs_dingtalk.sql | 30 +++---
.../V6__register_target_acs_eventbridge.sql | 30 +++---
...V7__update_event_connection_table_structure.sql | 35 +++----
.../db/migration/V8__update_unique_key.sql | 40 ++++----
.../rocketmq/impl/RocketMQEventDataRepository.java | 6 +-
.../eventbridge/enums/props/Constants.java | 37 +++++++
.../ServiceProviderNotFoundException.java | 37 +++++++
infrastructure/pom.xml | 11 +++
.../infrastructure/validate/AuthValidation.java | 42 ++++++++
.../validate/DefaultAuthValidation.java | 47 +++++++++
.../validate/spi/ServiceLifecycle.java | 31 ++++++
.../validate/spi/ValidationServiceFactory.java | 47 +++++++++
.../validate/spi/ValidationServiceLoader.java | 91 +++++++++++++++++
.../validate/spi/annotation/SingletonSPI.java | 31 ++++++
.../validate/spi/typed/TypedSPI.java | 45 +++++++++
.../validate/spi/typed/TypedSPIRegistry.java | 79 +++++++++++++++
...ntbridge.infrastructure.validate.AuthValidation | 6 +-
.../eventbridge/config/H2ServerConfig.java | 41 ++++++++
.../rocketmq/eventbridge/filter/LoginFilter.java | 26 ++---
.../eventbridge/filter/ValidateFilter.java | 63 ++++++++++++
start/src/main/resources/application.properties | 10 +-
29 files changed, 903 insertions(+), 178 deletions(-)
diff --git a/adapter/persistence/pom.xml b/adapter/persistence/pom.xml
index dd46427..eac0c8e 100644
--- a/adapter/persistence/pom.xml
+++ b/adapter/persistence/pom.xml
@@ -53,6 +53,11 @@
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector-java.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ </dependency>
+
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
diff --git a/adapter/persistence/src/main/java/org/apache/rocketmq/eventbridge/adapter/persistence/DatasourceConfig.java b/adapter/persistence/src/main/java/org/apache/rocketmq/eventbridge/adapter/persistence/DatasourceConfig.java
new file mode 100644
index 0000000..6718b8d
--- /dev/null
+++ b/adapter/persistence/src/main/java/org/apache/rocketmq/eventbridge/adapter/persistence/DatasourceConfig.java
@@ -0,0 +1,110 @@
+/*
+ * 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.rocketmq.eventbridge.adapter.persistence;
+
+import com.zaxxer.hikari.HikariConfig;
+import com.zaxxer.hikari.HikariDataSource;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.SqlSessionFactoryBean;
+import org.mybatis.spring.SqlSessionTemplate;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+
+import javax.sql.DataSource;
+
+/**
+ * DatasourceConfig
+ */
+@Configuration
+@MapperScan(basePackages = "org.apache.rocketmq.eventbridge.adapter.persistence.*.mybatis.*")
+public class DatasourceConfig {
+ private static final String MAPPER_LOCATION = "classpath:mybatis/*.xml";
+
+ @Value("${spring.datasource.hikari.jdbc-url:jdbc:h2:./rocketmq_eventbridge;MODE=MySQL}")
+ private String baseUrl;
+ @Value("${spring.datasource.hikari.driver-class-name:org.h2.Driver}")
+ private String baseDriverClassName;
+ @Value("${spring.datasource.hikari.username:sa}")
+ private String baseUserName;
+ @Value("${spring.datasource.hikari.password:sa}")
+ private String basePassword;
+
+ @Value("${spring.datasource.hikari.minimum-idle:5}")
+ private Integer minIdle;
+
+ @Value("${spring.datasource.hikari.idle-timeout:180000}")
+ private Long idleTimeoutMs;
+
+ @Value("${spring.datasource.hikari.maximum-pool-size: 10}")
+ private Integer maxPoolSize;
+
+ @Value("${spring.datasource.hikari.auto-commit: true}")
+ private Boolean autoCommit;
+
+ @Value("${spring.datasource.hikari.pool-name: hikaricp}")
+ private String poolName;
+
+ @Value("${spring.datasource.hikari.max-lifetime: 180000}")
+ private Long maxLifeTime;
+
+ @Value("${spring.datasource.hikari.connection-timeout: 30000}")
+ private Long connectionTimeoutMs;
+
+ @Value("${spring.datasource.hikari.connection-test-query: select 1}")
+ private String connectionTestQuery;
+
+ @Value("${spring.datasource.hikari.validation-timeout: 500}")
+ private Long validationTimeoutMs;
+
+ @Bean("dataSource")
+ public DataSource getMasterDataSource(){
+ HikariConfig hikariConfig = new HikariConfig();
+ hikariConfig.setJdbcUrl(baseUrl);
+ hikariConfig.setDriverClassName(baseDriverClassName);
+ hikariConfig.setUsername(baseUserName);
+ hikariConfig.setPassword(basePassword);
+ hikariConfig.setMinimumIdle(minIdle);
+ hikariConfig.setIdleTimeout(idleTimeoutMs);
+ hikariConfig.setMaximumPoolSize(maxPoolSize);
+ hikariConfig.setAutoCommit(autoCommit);
+ hikariConfig.setPoolName(poolName);
+ hikariConfig.setMaxLifetime(maxLifeTime);
+ hikariConfig.setConnectionTimeout(connectionTimeoutMs);
+ hikariConfig.setConnectionTestQuery(connectionTestQuery);
+ hikariConfig.setValidationTimeout(validationTimeoutMs);
+ return new HikariDataSource(hikariConfig);
+ }
+
+ @Bean("sqlSessionFactory")
+ public SqlSessionFactory masterSqlSessionFactory(@Qualifier("dataSource") DataSource dataSource) throws Exception {
+ SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
+ bean.setDataSource(dataSource);
+ bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(MAPPER_LOCATION));
+ return bean.getObject();
+ }
+
+ @Bean("sqlSessionTemplate")
+ public SqlSessionTemplate masterSqlSessionTemplate(@Qualifier("sqlSessionFactory") SqlSessionFactory sqlSessionFactory){
+ return new SqlSessionTemplate(sqlSessionFactory);
+ }
+
+}
+
diff --git a/adapter/persistence/src/main/java/org/apache/rocketmq/eventbridge/adapter/persistence/PersistenceConfig.java b/adapter/persistence/src/main/java/org/apache/rocketmq/eventbridge/adapter/persistence/PersistenceConfig.java
index 8b70fb9..d115ad2 100644
--- a/adapter/persistence/src/main/java/org/apache/rocketmq/eventbridge/adapter/persistence/PersistenceConfig.java
+++ b/adapter/persistence/src/main/java/org/apache/rocketmq/eventbridge/adapter/persistence/PersistenceConfig.java
@@ -20,13 +20,11 @@ package org.apache.rocketmq.eventbridge.adapter.persistence;
import lombok.SneakyThrows;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.tools.admin.DefaultMQAdminExt;
-import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
-@MapperScan(basePackages = "org.apache.rocketmq.eventbridge.adapter.persistence.*.mybatis.*")
public class PersistenceConfig {
@SneakyThrows
diff --git a/adapter/persistence/src/main/java/org/apache/rocketmq/eventbridge/adapter/persistence/target/mybatis/repository/MybatisEventTargetRunnerRepository.java b/adapter/persistence/src/main/java/org/apache/rocketmq/eventbridge/adapter/persistence/target/mybatis/repository/MybatisEventTargetRunnerRepository.java
index 4edeecd..0c92aa4 100644
--- a/adapter/persistence/src/main/java/org/apache/rocketmq/eventbridge/adapter/persistence/target/mybatis/repository/MybatisEventTargetRunnerRepository.java
+++ b/adapter/persistence/src/main/java/org/apache/rocketmq/eventbridge/adapter/persistence/target/mybatis/repository/MybatisEventTargetRunnerRepository.java
@@ -21,6 +21,8 @@ import com.google.gson.Gson;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.StringUtils;
import org.apache.rocketmq.eventbridge.adapter.persistence.target.mybatis.converter.EventTargetRunnerConverter;
import org.apache.rocketmq.eventbridge.adapter.persistence.target.mybatis.dataobject.EventTargetRunnerDO;
import org.apache.rocketmq.eventbridge.adapter.persistence.target.mybatis.mapper.EventTargetRunnerMapper;
@@ -72,6 +74,9 @@ public class MybatisEventTargetRunnerRepository implements EventTargetRunnerRepo
@Override
public List<EventTargetRunner> listEventTargetRunners(String accountId, String eventBusName, String eventRuleName) {
+ if (StringUtils.isBlank(accountId) || StringUtils.isBlank(eventBusName) || StringUtils.isBlank(eventRuleName)) {
+ return Lists.newArrayListWithCapacity(0);
+ }
List<EventTargetRunnerDO> eventTargetRunnerDOS = eventTargetRunnerMapper.listEventTargetRunners(accountId, eventBusName, eventRuleName);
if (eventTargetRunnerDOS == null || eventTargetRunnerDOS.isEmpty()) {
return Lists.newArrayListWithCapacity(0);
diff --git a/adapter/persistence/src/main/resources/db/migration/V1__baseline.sql b/adapter/persistence/src/main/resources/db/migration/V1__baseline.sql
index 6681b7e..3909293 100644
--- a/adapter/persistence/src/main/resources/db/migration/V1__baseline.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V1__baseline.sql
@@ -1,17 +1,19 @@
-# 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.
+/*
+ * 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.
+ */
CREATE TABLE IF NOT EXISTS `event_bus` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
@@ -21,11 +23,10 @@ CREATE TABLE IF NOT EXISTS `event_bus` (
`gmt_create` datetime DEFAULT NULL COMMENT 'create time',
`gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`account_id`,`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event bus meta'
-;
+ UNIQUE KEY `name_uniq_key_event_bus` (`account_id`,`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-CREATE TABLE `event_topic` (
+CREATE TABLE IF NOT EXISTS `event_topic` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id',
`bus` varchar(255) NOT NULL COMMENT 'bus name',
@@ -36,9 +37,8 @@ CREATE TABLE `event_topic` (
`gmt_create` datetime DEFAULT NULL COMMENT 'create time',
`gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-;
+ UNIQUE KEY `name_uniq_key_event_topicdd` (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `event_source` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
@@ -53,8 +53,8 @@ CREATE TABLE IF NOT EXISTS `event_source` (
`gmt_create` datetime DEFAULT NULL COMMENT 'create time',
`gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`account_id`,`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event source meta'
+ UNIQUE KEY `name_uniq_key_event_source` (`account_id`,`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
CREATE TABLE IF NOT EXISTS `event_type` (
@@ -67,12 +67,12 @@ CREATE TABLE IF NOT EXISTS `event_type` (
`gmt_create` datetime DEFAULT NULL COMMENT 'create time',
`gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`source`,`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event type meta'
+ UNIQUE KEY `name_uniq_key_event_type` (`source`,`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
CREATE TABLE IF NOT EXISTS `event_rule` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`account_id` varchar(255) NOT NULL COMMENT 'bus account id',
`bus` varchar(255) NOT NULL COMMENT 'bus name',
`name` varchar(255) NOT NULL COMMENT 'rule name',
@@ -82,8 +82,8 @@ CREATE TABLE IF NOT EXISTS `event_rule` (
`gmt_create` datetime DEFAULT NULL COMMENT 'create time',
`gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
UNIQUE KEY `id` (`id`),
- UNIQUE KEY `name_uniq_key` (`account_id`,`name`,`bus`)
-) ENGINE=InnoDB AUTO_INCREMENT=51815 DEFAULT CHARSET=utf8 COMMENT='event rule meta'
+ UNIQUE KEY `name_uniq_key_event_rule` (`account_id`,`name`,`bus`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
CREATE TABLE IF NOT EXISTS `event_source_runner` (
@@ -96,8 +96,8 @@ CREATE TABLE IF NOT EXISTS `event_source_runner` (
`gmt_create` datetime DEFAULT NULL COMMENT 'create time',
`gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`account_id`,`bus`,`source`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event source runner meta'
+ UNIQUE KEY `name_uniq_key_event_source_runner` (`account_id`,`bus`,`source`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
CREATE TABLE IF NOT EXISTS `event_target` (
@@ -112,8 +112,8 @@ CREATE TABLE IF NOT EXISTS `event_target` (
`gmt_create` datetime DEFAULT NULL COMMENT 'create time',
`gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`account_id`,`bus`,`rule`,`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event target meta'
+ UNIQUE KEY `name_uniq_key_event_target` (`account_id`,`bus`,`rule`,`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
@@ -128,8 +128,8 @@ CREATE TABLE IF NOT EXISTS `event_target_runner` (
`gmt_create` datetime DEFAULT NULL COMMENT 'create time',
`gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`account_id`,`bus`,`rule`,`target`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event target runner meta'
+ UNIQUE KEY `name_uniq_key_event_target_runner` (`account_id`,`bus`,`rule`,`target`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
@@ -144,8 +144,8 @@ CREATE TABLE IF NOT EXISTS `event_source_class` (
`gmt_create` datetime DEFAULT NULL COMMENT 'create time',
`gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event source class meta'
+ UNIQUE KEY `name_uniq_key_event_source_class` (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
@@ -160,6 +160,6 @@ CREATE TABLE IF NOT EXISTS `event_target_class` (
`gmt_create` datetime DEFAULT NULL COMMENT 'create time',
`gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event target class meta'
+ UNIQUE KEY `name_uniq_key_event_target_class` (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
diff --git a/adapter/persistence/src/main/resources/db/migration/V2__baseline.sql b/adapter/persistence/src/main/resources/db/migration/V2__baseline.sql
index 1d04ec5..c70912c 100644
--- a/adapter/persistence/src/main/resources/db/migration/V2__baseline.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V2__baseline.sql
@@ -1,17 +1,19 @@
-# 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.
+/*
+ * 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.
+ */
CREATE TABLE IF NOT EXISTS `event_connection` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
@@ -25,8 +27,8 @@ CREATE TABLE IF NOT EXISTS `event_connection` (
`gmt_create` datetime DEFAULT NULL COMMENT 'create time',
`gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`name`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event connection meta'
+ UNIQUE KEY `name_uniq_key_event_connection` (`name`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
@@ -42,6 +44,6 @@ CREATE TABLE IF NOT EXISTS `event_api_destination` (
`gmt_create` datetime DEFAULT NULL COMMENT 'create time',
`gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`name`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event api destination meta'
+ UNIQUE KEY `name_uniq_key_event_api_destination` (`name`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
diff --git a/adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql b/adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql
index edaf379..b2a18c2 100644
--- a/adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql
@@ -1,17 +1,19 @@
-# 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.
+/*
+ * 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.
+ */
ALTER TABLE `event_target_class`
CHANGE COLUMN `target_transform` `target_transform` TEXT NULL DEFAULT NULL ;
diff --git a/adapter/persistence/src/main/resources/db/migration/V4__register_source_acs_mns.sql b/adapter/persistence/src/main/resources/db/migration/V4__register_source_acs_mns.sql
index 7e826f0..1ad499a 100644
--- a/adapter/persistence/src/main/resources/db/migration/V4__register_source_acs_mns.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V4__register_source_acs_mns.sql
@@ -1,16 +1,18 @@
-# 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.
+/*
+ * 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.
+ */
INSERT INTO `event_source_class` (`name`,`api_params`,`required_params`,`transform`,`visual_config`,`description`,`gmt_create`,`gmt_modify`) VALUES ('acs.mns','{\n \"RegionId\":{\n \"type\":\"String\",\n \"desc\":\"the region of aliyun mns.\",\n \"required\":true,\n \"defaultValue\":\"\"\n },\n \"QueueName\":{\n \"type\":\"String\",\n \"desc\":\"the queue name of aliyun mns.\",\n \"required\":true,\n \"defaultValue\":\"\"\n [...]
diff --git a/adapter/persistence/src/main/resources/db/migration/V5__register_target_acs_dingtalk.sql b/adapter/persistence/src/main/resources/db/migration/V5__register_target_acs_dingtalk.sql
index 31291a1..1d8a643 100644
--- a/adapter/persistence/src/main/resources/db/migration/V5__register_target_acs_dingtalk.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V5__register_target_acs_dingtalk.sql
@@ -1,17 +1,19 @@
-# 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.
+/*
+ * 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.
+ */
INSERT INTO `event_target_class` (`name`,`api_params`,`target_transform`,`required_params`,`visual_config`,`description`,`gmt_create`,`gmt_modify`)
VALUES
diff --git a/adapter/persistence/src/main/resources/db/migration/V6__register_target_acs_eventbridge.sql b/adapter/persistence/src/main/resources/db/migration/V6__register_target_acs_eventbridge.sql
index e4c20c1..b7587a0 100644
--- a/adapter/persistence/src/main/resources/db/migration/V6__register_target_acs_eventbridge.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V6__register_target_acs_eventbridge.sql
@@ -1,17 +1,19 @@
-# 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.
+/*
+ * 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.
+ */
INSERT INTO `event_target_class` (`name`,`api_params`,`target_transform`,`required_params`,`visual_config`,`description`,`gmt_create`,`gmt_modify`)
VALUES
diff --git a/adapter/persistence/src/main/resources/db/migration/V7__update_event_connection_table_structure.sql b/adapter/persistence/src/main/resources/db/migration/V7__update_event_connection_table_structure.sql
index 82be349..e98bbf0 100644
--- a/adapter/persistence/src/main/resources/db/migration/V7__update_event_connection_table_structure.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V7__update_event_connection_table_structure.sql
@@ -1,18 +1,19 @@
-# 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.
+/*
+ * 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.
+ */
-ALTER TABLE `event_connection`
-MODIFY COLUMN `authorization_type` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '授权类型' AFTER `name`,
-MODIFY COLUMN `auth_parameters` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER `authorization_type`;
\ No newline at end of file
+--ALTER TABLE `event_connection` MODIFY COLUMN `authorization_type` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '授权类型' AFTER `name`;
+--ALTER TABLE `event_connection` MODIFY COLUMN `auth_parameters` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER `authorization_type`;
\ No newline at end of file
diff --git a/adapter/persistence/src/main/resources/db/migration/V8__update_unique_key.sql b/adapter/persistence/src/main/resources/db/migration/V8__update_unique_key.sql
index f25bfb0..2e9098e 100644
--- a/adapter/persistence/src/main/resources/db/migration/V8__update_unique_key.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V8__update_unique_key.sql
@@ -1,22 +1,22 @@
-# 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.
+/*
+ * 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.
+ */
-ALTER TABLE `event_connection`
-DROP INDEX `name_uniq_key`,
-ADD UNIQUE INDEX `name_uniq_key`(`name`, `account_id`) USING BTREE;
+ALTER TABLE `event_connection` DROP INDEX `name_uniq_key_event_connection`;
+ALTER TABLE `event_connection` ADD UNIQUE INDEX `name_uniq_key_event_connection`(`name`, `account_id`) USING BTREE;
-ALTER TABLE `event_api_destination`
-DROP INDEX `name_uniq_key`,
-ADD UNIQUE INDEX `name_uniq_key`(`name`, `account_id`) USING BTREE;
\ No newline at end of file
+ALTER TABLE `event_api_destination` DROP INDEX `name_uniq_key_event_api_destination`;
+ALTER TABLE `event_api_destination` ADD UNIQUE INDEX `name_uniq_key_event_api_destination`(`name`, `account_id`) USING BTREE;
\ No newline at end of file
diff --git a/adapter/storage/src/main/java/org/apache/rocketmq/eventbridge/adapter/storage/rocketmq/impl/RocketMQEventDataRepository.java b/adapter/storage/src/main/java/org/apache/rocketmq/eventbridge/adapter/storage/rocketmq/impl/RocketMQEventDataRepository.java
index 4e6f64e..320c69e 100644
--- a/adapter/storage/src/main/java/org/apache/rocketmq/eventbridge/adapter/storage/rocketmq/impl/RocketMQEventDataRepository.java
+++ b/adapter/storage/src/main/java/org/apache/rocketmq/eventbridge/adapter/storage/rocketmq/impl/RocketMQEventDataRepository.java
@@ -20,6 +20,7 @@ package org.apache.rocketmq.eventbridge.adapter.storage.rocketmq.impl;
import com.google.gson.Gson;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.eventbridge.adapter.persistence.data.mybatis.dataobject.EventTopicDO;
@@ -92,7 +93,10 @@ public class RocketMQEventDataRepository implements EventDataRepository {
@Cacheable(value = "topicCache")
@Override
public String getTopicName(String accountId, String eventBusName) {
- String topicName = null;
+ String topicName = eventDataOnRocketMQConnectAPI.buildTopicName(accountId, eventBusName);
+ if (StringUtils.isBlank(AppConfig.getGlobalConfig().getDefaultDataPersistentClusterName())) {
+ return topicName;
+ }
EventTopicDO eventTopicDO = eventTopicMapper.getTopic(accountId, eventBusName);
if (eventTopicDO != null) {
topicName = eventTopicDO.getName();
diff --git a/common/src/main/java/org/apache/rocketmq/eventbridge/enums/props/Constants.java b/common/src/main/java/org/apache/rocketmq/eventbridge/enums/props/Constants.java
new file mode 100644
index 0000000..dfd1d30
--- /dev/null
+++ b/common/src/main/java/org/apache/rocketmq/eventbridge/enums/props/Constants.java
@@ -0,0 +1,37 @@
+/*
+ * 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.rocketmq.eventbridge.enums.props;
+
+/**
+ * Constants
+ */
+public enum Constants {
+ HEADER_KEY_RESOURCE_OWNER_ACCOUNT_ID("resourceOwnerAccountId"),
+ HEADER_KEY_LOGIN_ACCOUNT_ID("loginAccountId"),
+ HEADER_KEY_PARENT_ACCOUNT_ID("parentAccountId"),
+ ;
+
+ private String name;
+
+ Constants(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+}
diff --git a/common/src/main/java/org/apache/rocketmq/eventbridge/exception/ServiceProviderNotFoundException.java b/common/src/main/java/org/apache/rocketmq/eventbridge/exception/ServiceProviderNotFoundException.java
new file mode 100644
index 0000000..37f7b3f
--- /dev/null
+++ b/common/src/main/java/org/apache/rocketmq/eventbridge/exception/ServiceProviderNotFoundException.java
@@ -0,0 +1,37 @@
+/*
+ * 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.rocketmq.eventbridge.exception;
+
+
+/**
+ * Service provider not found exception.
+ *
+ */
+public final class ServiceProviderNotFoundException extends EventBridgeException {
+
+ private static final long serialVersionUID = -3730257541332863236L;
+
+ private static final String ERROR_CATEGORY = "SPI";
+
+ private static final int ERROR_CODE = 500;
+
+ public ServiceProviderNotFoundException(final Class<?> clazz, final String type) {
+ super(String.format("%s-%05d: %s %s", ERROR_CATEGORY, ERROR_CODE, String.format("No implementation class load from SPI `%s`:", clazz.getName()), type));
+ }
+
+}
diff --git a/infrastructure/pom.xml b/infrastructure/pom.xml
index d419a45..5db59ef 100644
--- a/infrastructure/pom.xml
+++ b/infrastructure/pom.xml
@@ -26,4 +26,15 @@
<maven.compiler.target>8</maven.compiler.target>
</properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.rocketmq</groupId>
+ <artifactId>rocketmq-eventbridge-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-webflux</artifactId>
+ </dependency>
+ </dependencies>
+
</project>
\ No newline at end of file
diff --git a/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/AuthValidation.java b/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/AuthValidation.java
new file mode 100644
index 0000000..c2a86a1
--- /dev/null
+++ b/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/AuthValidation.java
@@ -0,0 +1,42 @@
+/*
+ * 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.rocketmq.eventbridge.infrastructure.validate;
+
+
+import org.apache.rocketmq.eventbridge.infrastructure.validate.spi.ServiceLifecycle;
+import org.apache.rocketmq.eventbridge.infrastructure.validate.spi.typed.TypedSPI;
+import org.springframework.http.server.reactive.ServerHttpRequest;
+import reactor.util.context.Context;
+
+/**
+ * AuthValidation
+ */
+public interface AuthValidation extends ServiceLifecycle, TypedSPI {
+
+ Context validate(ServerHttpRequest request, Context ctx);
+
+ @Override
+ default void init() {
+
+ }
+
+ @Override
+ default void shutdown(){
+
+ }
+}
diff --git a/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/DefaultAuthValidation.java b/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/DefaultAuthValidation.java
new file mode 100644
index 0000000..f85517d
--- /dev/null
+++ b/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/DefaultAuthValidation.java
@@ -0,0 +1,47 @@
+/*
+ * 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.rocketmq.eventbridge.infrastructure.validate;
+
+import org.springframework.http.server.reactive.ServerHttpRequest;
+import reactor.util.context.Context;
+
+import java.util.List;
+
+import static org.apache.rocketmq.eventbridge.enums.props.Constants.HEADER_KEY_RESOURCE_OWNER_ACCOUNT_ID;
+
+/**
+ * DefaultAuthValidation
+ */
+public class DefaultAuthValidation implements AuthValidation {
+
+ @Override
+ public Context validate(ServerHttpRequest request, Context ctx) {
+ String resourceOwnerId = "defaultResourceOwnerId";
+ List<String> resourceOwnerIds = request.getHeaders().get(HEADER_KEY_RESOURCE_OWNER_ACCOUNT_ID);
+ if (resourceOwnerIds != null && !resourceOwnerIds.isEmpty()) {
+ //throw new EventBridgeException(DefaultErrorCode.LoginFailed);
+ resourceOwnerId = resourceOwnerIds.get(0);
+ }
+ return ctx.put(HEADER_KEY_RESOURCE_OWNER_ACCOUNT_ID.getName(), resourceOwnerId);
+ }
+
+ @Override
+ public String getType() {
+ return "default";
+ }
+}
diff --git a/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/ServiceLifecycle.java b/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/ServiceLifecycle.java
new file mode 100644
index 0000000..517264c
--- /dev/null
+++ b/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/ServiceLifecycle.java
@@ -0,0 +1,31 @@
+/*
+ * 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.rocketmq.eventbridge.infrastructure.validate.spi;
+
+/**
+ * ServiceLifecycle
+ *
+ */
+public interface ServiceLifecycle {
+ /**
+ * Used for startup or initialization of a service endpoint. A service endpoint instance will be in a ready state
+ * after this method has been completed.
+ */
+ void init();
+
+ /**
+ * Notify a service instance of the end of its life cycle. Once this method completes, the service endpoint could be
+ * destroyed and eligible for garbage collection.
+ */
+ void shutdown();
+}
\ No newline at end of file
diff --git a/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/ValidationServiceFactory.java b/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/ValidationServiceFactory.java
new file mode 100644
index 0000000..e467e9e
--- /dev/null
+++ b/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/ValidationServiceFactory.java
@@ -0,0 +1,47 @@
+/*
+ * 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.rocketmq.eventbridge.infrastructure.validate.spi;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.rocketmq.eventbridge.infrastructure.validate.AuthValidation;
+import org.apache.rocketmq.eventbridge.infrastructure.validate.spi.typed.TypedSPIRegistry;
+
+/**
+ * validation service load factory.
+ *
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ValidationServiceFactory {
+ static {
+ ValidationServiceLoader.register(AuthValidation.class);
+ }
+
+ /**
+ * Get instance of cluster persist repository.
+ *
+ * @param type persist repository configuration
+ * @return got instance
+ */
+ public static AuthValidation getInstance(final String type) {
+ AuthValidation result = TypedSPIRegistry.getRegisteredService(AuthValidation.class, type);
+ result.init();
+ return result;
+ }
+
+}
diff --git a/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/ValidationServiceLoader.java b/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/ValidationServiceLoader.java
new file mode 100644
index 0000000..a2c220e
--- /dev/null
+++ b/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/ValidationServiceLoader.java
@@ -0,0 +1,91 @@
+/*
+ * 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.rocketmq.eventbridge.infrastructure.validate.spi;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import lombok.SneakyThrows;
+import org.apache.rocketmq.eventbridge.infrastructure.validate.spi.annotation.SingletonSPI;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.ServiceLoader;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * validation service loader.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ValidationServiceLoader {
+
+ private static final Map<Class<?>, Collection<Object>> SERVICES = new ConcurrentHashMap<>();
+
+ /**
+ * Register service.
+ *
+ * @param serviceInterface service interface
+ */
+ public static void register(final Class<?> serviceInterface) {
+ if (!SERVICES.containsKey(serviceInterface)) {
+ SERVICES.put(serviceInterface, load(serviceInterface));
+ }
+ }
+
+ private static <T> Collection<Object> load(final Class<T> serviceInterface) {
+ Collection<Object> result = new LinkedList<>();
+ for (T each : ServiceLoader.load(serviceInterface)) {
+ result.add(each);
+ }
+ return result;
+ }
+
+ /**
+ * Get service instances.
+ *
+ * @param serviceInterface service interface
+ * @param <T> type of service
+ * @return service instances
+ */
+ public static <T> Collection<T> getServiceInstances(final Class<T> serviceInterface) {
+ return null == serviceInterface.getAnnotation(SingletonSPI.class) ? createNewServiceInstances(serviceInterface) : getSingletonServiceInstances(serviceInterface);
+ }
+
+ @SneakyThrows(ReflectiveOperationException.class)
+ @SuppressWarnings("unchecked")
+ private static <T> Collection<T> createNewServiceInstances(final Class<T> serviceInterface) {
+ if (!SERVICES.containsKey(serviceInterface)) {
+ return Collections.emptyList();
+ }
+ Collection<Object> services = SERVICES.get(serviceInterface);
+ if (services.isEmpty()) {
+ return Collections.emptyList();
+ }
+ Collection<T> result = new LinkedList<>();
+ for (Object each : services) {
+ result.add((T) each.getClass().getDeclaredConstructor().newInstance());
+ }
+ return result;
+ }
+
+ @SuppressWarnings("unchecked")
+ private static <T> Collection<T> getSingletonServiceInstances(final Class<T> serviceInterface) {
+ return (Collection<T>) SERVICES.getOrDefault(serviceInterface, Collections.emptyList());
+ }
+}
diff --git a/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/annotation/SingletonSPI.java b/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/annotation/SingletonSPI.java
new file mode 100644
index 0000000..cd61305
--- /dev/null
+++ b/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/annotation/SingletonSPI.java
@@ -0,0 +1,31 @@
+/*
+ * 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.rocketmq.eventbridge.infrastructure.validate.spi.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation of singleton SPI.
+ */
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface SingletonSPI {
+}
diff --git a/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/typed/TypedSPI.java b/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/typed/TypedSPI.java
new file mode 100644
index 0000000..65a0cbb
--- /dev/null
+++ b/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/typed/TypedSPI.java
@@ -0,0 +1,45 @@
+/*
+ * 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.rocketmq.eventbridge.infrastructure.validate.spi.typed;
+
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * Typed SPI.
+ */
+public interface TypedSPI {
+
+ /**
+ * Get type.
+ *
+ * @return type
+ */
+ default String getType() {
+ return "";
+ }
+
+ /**
+ * Get type aliases.
+ *
+ * @return type aliases
+ */
+ default Collection<String> getTypeAliases() {
+ return Collections.emptyList();
+ }
+}
diff --git a/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/typed/TypedSPIRegistry.java b/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/typed/TypedSPIRegistry.java
new file mode 100644
index 0000000..104da6d
--- /dev/null
+++ b/infrastructure/src/main/java/org/apache/rocketmq/eventbridge/infrastructure/validate/spi/typed/TypedSPIRegistry.java
@@ -0,0 +1,79 @@
+/*
+ * 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.rocketmq.eventbridge.infrastructure.validate.spi.typed;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.rocketmq.eventbridge.exception.ServiceProviderNotFoundException;
+import org.apache.rocketmq.eventbridge.infrastructure.validate.spi.ValidationServiceLoader;
+
+import java.util.Optional;
+import java.util.Properties;
+
+/**
+ * Typed SPI registry.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class TypedSPIRegistry {
+
+ /**
+ * Find registered service.
+ *
+ * @param spiClass typed SPI class
+ * @param type type
+ * @param <T> SPI class type
+ * @return registered service
+ */
+ public static <T extends TypedSPI> Optional<T> findRegisteredService(final Class<T> spiClass, final String type) {
+ for (T each : ValidationServiceLoader.getServiceInstances(spiClass)) {
+ if (matchesType(type, each)) {
+ return Optional.of(each);
+ }
+ }
+ return Optional.empty();
+ }
+
+ private static boolean matchesType(final String type, final TypedSPI instance) {
+ return instance.getType().equalsIgnoreCase(type) || instance.getTypeAliases().contains(type);
+ }
+
+ private static Properties convertToStringTypedProperties(final Properties props) {
+ if (null == props) {
+ return new Properties();
+ }
+ Properties result = new Properties();
+ props.forEach((key, value) -> result.setProperty(key.toString(), null == value ? null : value.toString()));
+ return result;
+ }
+
+ /**
+ * Get registered service.
+ *
+ * @param spiClass typed SPI class
+ * @param type type
+ * @param <T> SPI class type
+ * @return registered service
+ */
+ public static <T extends TypedSPI> T getRegisteredService(final Class<T> spiClass, final String type) {
+ Optional<T> result = findRegisteredService(spiClass, type);
+ if (result.isPresent()) {
+ return result.get();
+ }
+ throw new ServiceProviderNotFoundException(spiClass, type);
+ }
+}
diff --git a/adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql b/infrastructure/src/main/resources/META-INF/services/org.apache.rocketmq.eventbridge.infrastructure.validate.AuthValidation
similarity index 87%
copy from adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql
copy to infrastructure/src/main/resources/META-INF/services/org.apache.rocketmq.eventbridge.infrastructure.validate.AuthValidation
index edaf379..205672f 100644
--- a/adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql
+++ b/infrastructure/src/main/resources/META-INF/services/org.apache.rocketmq.eventbridge.infrastructure.validate.AuthValidation
@@ -1,3 +1,4 @@
+#
# 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.
@@ -12,6 +13,5 @@
# 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.
-
-ALTER TABLE `event_target_class`
-CHANGE COLUMN `target_transform` `target_transform` TEXT NULL DEFAULT NULL ;
+#
+org.apache.rocketmq.eventbridge.infrastructure.validate.DefaultAuthValidation
\ No newline at end of file
diff --git a/start/src/main/java/org/apache/rocketmq/eventbridge/config/H2ServerConfig.java b/start/src/main/java/org/apache/rocketmq/eventbridge/config/H2ServerConfig.java
new file mode 100644
index 0000000..e7c1990
--- /dev/null
+++ b/start/src/main/java/org/apache/rocketmq/eventbridge/config/H2ServerConfig.java
@@ -0,0 +1,41 @@
+/*
+ * 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.rocketmq.eventbridge.config;
+
+import org.h2.tools.Server;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.context.event.ContextClosedEvent;
+import org.springframework.context.event.ContextRefreshedEvent;
+import org.springframework.context.event.EventListener;
+
+@Configuration
+@Profile("local")
+public class H2ServerConfig {
+ private Server webServer;
+
+
+ @EventListener(ContextRefreshedEvent.class)
+ public void start() throws java.sql.SQLException {
+ this.webServer = org.h2.tools.Server.createWebServer("-webPort", "8083", "-web", "-webAllowOthers", "-tcp", "-tcpAllowOthers", "-browser").start();
+ }
+
+ @EventListener(ContextClosedEvent.class)
+ public void stop() {
+ this.webServer.stop();
+ }
+}
diff --git a/start/src/main/java/org/apache/rocketmq/eventbridge/filter/LoginFilter.java b/start/src/main/java/org/apache/rocketmq/eventbridge/filter/LoginFilter.java
index af7cb04..5afafae 100644
--- a/start/src/main/java/org/apache/rocketmq/eventbridge/filter/LoginFilter.java
+++ b/start/src/main/java/org/apache/rocketmq/eventbridge/filter/LoginFilter.java
@@ -18,8 +18,6 @@ package org.apache.rocketmq.eventbridge.filter;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
-import org.apache.rocketmq.eventbridge.exception.EventBridgeException;
-import org.apache.rocketmq.eventbridge.exception.code.DefaultErrorCode;
import org.springframework.core.annotation.Order;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.stereotype.Component;
@@ -28,35 +26,27 @@ import org.springframework.web.server.WebFilter;
import org.springframework.web.server.WebFilterChain;
import reactor.core.publisher.Mono;
+import static org.apache.rocketmq.eventbridge.enums.props.Constants.HEADER_KEY_LOGIN_ACCOUNT_ID;
+import static org.apache.rocketmq.eventbridge.enums.props.Constants.HEADER_KEY_PARENT_ACCOUNT_ID;
+
@Component
@Order(value = 2)
@Slf4j
public class LoginFilter implements WebFilter {
- public static final String HEADER_KEY_LOGIN_ACCOUNT_ID = "loginAccountId";
- public static final String HEADER_KEY_PARENT_ACCOUNT_ID = "parentAccountId";
- public static final String HEADER_KEY_RESOURCE_OWNER_ACCOUNT_ID = "resourceOwnerAccountId";
-
@Override
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
ServerHttpRequest request = exchange.getRequest();
return chain.filter(exchange)
.subscriberContext(ctx -> {
List<String> parentAccountIds = request.getHeaders()
- .get(HEADER_KEY_PARENT_ACCOUNT_ID);
+ .get(HEADER_KEY_PARENT_ACCOUNT_ID.getName());
List<String> loginAccountIds = request.getHeaders()
- .get(HEADER_KEY_LOGIN_ACCOUNT_ID);
- List<String> resourceOwnerIds = request.getHeaders()
- .get(HEADER_KEY_RESOURCE_OWNER_ACCOUNT_ID);
- if (resourceOwnerIds == null || resourceOwnerIds.isEmpty()) {
- throw new EventBridgeException(DefaultErrorCode.LoginFailed);
- }
- return ctx.put(HEADER_KEY_PARENT_ACCOUNT_ID,
+ .get(HEADER_KEY_LOGIN_ACCOUNT_ID.getName());
+ return ctx.put(HEADER_KEY_PARENT_ACCOUNT_ID.getName(),
parentAccountIds != null && !parentAccountIds.isEmpty() ? parentAccountIds.get(0) : "")
- .put(HEADER_KEY_LOGIN_ACCOUNT_ID,
- loginAccountIds != null && !loginAccountIds.isEmpty() ? loginAccountIds.get(0) : "")
- .put(HEADER_KEY_RESOURCE_OWNER_ACCOUNT_ID,
- resourceOwnerIds != null && !resourceOwnerIds.isEmpty() ? resourceOwnerIds.get(0) : "");
+ .put(HEADER_KEY_LOGIN_ACCOUNT_ID.getName(),
+ loginAccountIds != null && !loginAccountIds.isEmpty() ? loginAccountIds.get(0) : "");
});
}
}
diff --git a/start/src/main/java/org/apache/rocketmq/eventbridge/filter/ValidateFilter.java b/start/src/main/java/org/apache/rocketmq/eventbridge/filter/ValidateFilter.java
new file mode 100644
index 0000000..5d80328
--- /dev/null
+++ b/start/src/main/java/org/apache/rocketmq/eventbridge/filter/ValidateFilter.java
@@ -0,0 +1,63 @@
+/*
+ * 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.rocketmq.eventbridge.filter;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.rocketmq.eventbridge.infrastructure.validate.AuthValidation;
+import org.apache.rocketmq.eventbridge.infrastructure.validate.spi.ValidationServiceFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.annotation.Order;
+import org.springframework.http.server.reactive.ServerHttpRequest;
+import org.springframework.stereotype.Component;
+import org.springframework.web.server.ServerWebExchange;
+import org.springframework.web.server.WebFilter;
+import org.springframework.web.server.WebFilterChain;
+import reactor.core.publisher.Mono;
+import reactor.util.context.Context;
+
+import javax.annotation.PostConstruct;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.atomic.AtomicReference;
+
+@Component
+@Order(value = 3)
+@Slf4j
+public class ValidateFilter implements WebFilter {
+
+ private List<AuthValidation> validations = new CopyOnWriteArrayList<>();
+
+ @Value(value="${auth.validation:default}")
+ private String validationName;
+
+ @PostConstruct
+ public void init() {
+ Arrays.stream(validationName.split(",")).forEach(action->validations.add(ValidationServiceFactory.getInstance(action)));
+ }
+
+ @Override
+ public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
+ ServerHttpRequest request = exchange.getRequest();
+ return chain.filter(exchange)
+ .subscriberContext(ctx -> {
+ AtomicReference<Context> result = new AtomicReference<Context>();
+ validations.forEach(validation-> result.set(validation.validate(request, ctx)));
+ return result.get();
+ });
+ }
+}
diff --git a/start/src/main/resources/application.properties b/start/src/main/resources/application.properties
index 185ba48..3736814 100644
--- a/start/src/main/resources/application.properties
+++ b/start/src/main/resources/application.properties
@@ -16,12 +16,12 @@
server.port=7001
management.server.port=7002
management.endpoints.web.base-path=/
+spring.profiles.active=local
## database
-spring.datasource.url=jdbc:mysql://localhost:3306/eventBridge?useUnicode=true&characterEncoding=utf8&useSSL=false
-spring.datasource.driver-class-name=com.mysql.jdbc.Driver
-spring.datasource.username=xxxxx
-spring.datasource.password=xxxxx
-mybatis.mapper-locations=classpath:mybatis/*.xml
+#spring.datasource.hikari.jdbc-url=jdbc:mysql://localhost:3306/eventBridge?useUnicode=true&characterEncoding=utf8&useSSL=false
+#spring.datasource.hikari.driver-class-name=com.mysql.jdbc.Driver
+#spring.datasource.hikari.username=xxxxx
+#spring.datasource.hikari.password=xxxxx
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
## flyway
spring.flyway.placeholderReplacement=false
[rocketmq-eventbridge] 04/04: 1.merge h2-migration and migration
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
shenlin pushed a commit to branch runtimer
in repository https://gitbox.apache.org/repos/asf/rocketmq-eventbridge.git
commit d03c361d6c3ee26a1303bcc4bfb70262b72001c6
Author: wangkai <wa...@zhongan.com>
AuthorDate: Mon Jun 5 20:03:15 2023 +0800
1.merge h2-migration and migration
---
.../resources/db/h2-migration/V1__baseline.sql | 165 -------------
.../resources/db/h2-migration/V2__baseline.sql | 49 ----
.../V3__change_target_transform_type.sql | 19 --
.../h2-migration/V4__register_source_acs_mns.sql | 18 --
.../V5__register_target_acs_dingtalk.sql | 20 --
.../V6__register_target_acs_eventbridge.sql | 20 --
...V7__update_event_connection_table_structure.sql | 19 --
.../db/h2-migration/V8__update_unique_key.sql | 22 --
.../main/resources/db/migration/V1__baseline.sql | 256 ++++++++++-----------
.../main/resources/db/migration/V2__baseline.sql | 44 ++--
.../migration/V3__change_target_transform_type.sql | 32 +--
.../db/migration/V4__register_source_acs_mns.sql | 32 +--
.../migration/V5__register_target_acs_dingtalk.sql | 30 +--
.../V6__register_target_acs_eventbridge.sql | 32 +--
...V7__update_event_connection_table_structure.sql | 35 +--
.../db/migration/V8__update_unique_key.sql | 40 ++--
docs/cn/RocketMQEventBridgeDatabaseUsage.md | 12 +-
start/src/main/resources/application.properties | 1 -
18 files changed, 262 insertions(+), 584 deletions(-)
diff --git a/adapter/persistence/src/main/resources/db/h2-migration/V1__baseline.sql b/adapter/persistence/src/main/resources/db/h2-migration/V1__baseline.sql
deleted file mode 100644
index 3909293..0000000
--- a/adapter/persistence/src/main/resources/db/h2-migration/V1__baseline.sql
+++ /dev/null
@@ -1,165 +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.
- */
-
-CREATE TABLE IF NOT EXISTS `event_bus` (
- `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) NOT NULL COMMENT 'bus account id',
- `name` varchar(255) NOT NULL COMMENT 'bus name',
- `description` varchar(256) DEFAULT NULL COMMENT 'bus description',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_bus` (`account_id`,`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-CREATE TABLE IF NOT EXISTS `event_topic` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `name` varchar(255) NOT NULL COMMENT 'topic name',
- `msg_ttl` int(11) NOT NULL COMMENT 'msg ttl',
- `cluster` varchar(255) NOT NULL COMMENT 'the cluster of topic',
- `status` tinyint(4) NOT NULL COMMENT '0:disable, 1:enable',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_topicdd` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-CREATE TABLE IF NOT EXISTS `event_source` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'source name',
- `status` int(11) NOT NULL DEFAULT '0' COMMENT '0:disable, 1:enable',
- `type` int(11) NOT NULL DEFAULT '1' COMMENT 'event source type',
- `class_name` varchar(255) COMMENT 'event source class name',
- `config` text COMMENT 'event source runner config',
- `description` varchar(1024) DEFAULT NULL COMMENT 'event source description',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_source` (`account_id`,`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-;
-
-CREATE TABLE IF NOT EXISTS `event_type` (
- `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) NOT NULL COMMENT 'bus account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `source` varchar(255) NOT NULL DEFAULT '' COMMENT 'event source name',
- `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'event type name',
- `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event type',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_type` (`source`,`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-;
-
-CREATE TABLE IF NOT EXISTS `event_rule` (
- `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) NOT NULL COMMENT 'bus account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `name` varchar(255) NOT NULL COMMENT 'rule name',
- `filter_pattern` varchar(4096) DEFAULT NULL COMMENT 'event filter pattern',
- `status` tinyint(4) NOT NULL COMMENT '0:disable, 1:enable',
- `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event rule',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- UNIQUE KEY `id` (`id`),
- UNIQUE KEY `name_uniq_key_event_rule` (`account_id`,`name`,`bus`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-;
-
-CREATE TABLE IF NOT EXISTS `event_source_runner` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `source` varchar(255) NOT NULL DEFAULT '' COMMENT 'source name',
- `run_options` varchar(1024) DEFAULT NULL COMMENT 'event source runner options',
- `run_context` varchar(1024) DEFAULT NULL COMMENT 'event source running context',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_source_runner` (`account_id`,`bus`,`source`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-;
-
-CREATE TABLE IF NOT EXISTS `event_target` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'target account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `rule` varchar(255) NOT NULL DEFAULT '' COMMENT 'rule name',
- `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'target name',
- `class_name` varchar(255) NOT NULL COMMENT 'event target class name',
- `config` text NOT NULL COMMENT 'event target runner config',
- `run_options` varchar(1024) DEFAULT NULL COMMENT 'event target runner options',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_target` (`account_id`,`bus`,`rule`,`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-;
-
-
-
-CREATE TABLE IF NOT EXISTS `event_target_runner` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'target account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `rule` varchar(255) NOT NULL DEFAULT '' COMMENT 'rule name',
- `target` varchar(255) NOT NULL DEFAULT '' COMMENT 'target name',
- `run_context` varchar(1024) DEFAULT NULL COMMENT 'event target running context',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_target_runner` (`account_id`,`bus`,`rule`,`target`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-;
-
-
-CREATE TABLE IF NOT EXISTS `event_source_class` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'source class name',
- `api_params` text NOT NULL COMMENT 'event source api params',
- `required_params` text NOT NULL COMMENT 'event source required params',
- `transform` text NOT NULL COMMENT 'transform the event source data',
- `visual_config` text DEFAULT NULL COMMENT 'event source fore-end visual config',
- `description` varchar(255) DEFAULT NULL COMMENT 'a description about the source class',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_source_class` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-;
-
-
-CREATE TABLE IF NOT EXISTS `event_target_class` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'target class name',
- `api_params` text NOT NULL COMMENT 'event target api params',
- `target_transform` text NOT NULL COMMENT 'event target required data',
- `required_params` text NOT NULL COMMENT 'event target required params',
- `visual_config` text DEFAULT NULL COMMENT 'event target fore-end visual config',
- `description` varchar(255) DEFAULT NULL COMMENT 'a description about the target class',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_target_class` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-;
diff --git a/adapter/persistence/src/main/resources/db/h2-migration/V2__baseline.sql b/adapter/persistence/src/main/resources/db/h2-migration/V2__baseline.sql
deleted file mode 100644
index c70912c..0000000
--- a/adapter/persistence/src/main/resources/db/h2-migration/V2__baseline.sql
+++ /dev/null
@@ -1,49 +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.
- */
-
-CREATE TABLE IF NOT EXISTS `event_connection` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) NOT NULL COMMENT 'event_connection account id',
- `name` varchar(128) NOT NULL DEFAULT '' COMMENT '名称',
- `authorization_type` varchar(128) DEFAULT NULL COMMENT '授权类型',
- `auth_parameters` text DEFAULT NULL COMMENT '',
- `network_type` varchar(128) NOT NULL DEFAULT '' COMMENT '网络类型',
- `network_parameters` text DEFAULT NULL COMMENT '网络配置',
- `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event_connection',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_connection` (`name`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8
-;
-
-
-CREATE TABLE IF NOT EXISTS `event_api_destination` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) NOT NULL COMMENT 'event_api_destination account id',
- `name` varchar(128) NOT NULL DEFAULT '' COMMENT '名称',
- `protocol` varchar(128) NOT NULL DEFAULT '' COMMENT '类型',
- `api_params` text NOT NULL COMMENT 'API 参数',
- `connection_name` varchar(128) DEFAULT NULL COMMENT '连接信息',
- `invocation_rate_limit_per_second` int(11) COMMENT '每秒推送速率',
- `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event_api_destination',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_api_destination` (`name`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8
-;
diff --git a/adapter/persistence/src/main/resources/db/h2-migration/V3__change_target_transform_type.sql b/adapter/persistence/src/main/resources/db/h2-migration/V3__change_target_transform_type.sql
deleted file mode 100644
index b2a18c2..0000000
--- a/adapter/persistence/src/main/resources/db/h2-migration/V3__change_target_transform_type.sql
+++ /dev/null
@@ -1,19 +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.
- */
-
-ALTER TABLE `event_target_class`
-CHANGE COLUMN `target_transform` `target_transform` TEXT NULL DEFAULT NULL ;
diff --git a/adapter/persistence/src/main/resources/db/h2-migration/V4__register_source_acs_mns.sql b/adapter/persistence/src/main/resources/db/h2-migration/V4__register_source_acs_mns.sql
deleted file mode 100644
index 1ad499a..0000000
--- a/adapter/persistence/src/main/resources/db/h2-migration/V4__register_source_acs_mns.sql
+++ /dev/null
@@ -1,18 +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.
- */
-
-INSERT INTO `event_source_class` (`name`,`api_params`,`required_params`,`transform`,`visual_config`,`description`,`gmt_create`,`gmt_modify`) VALUES ('acs.mns','{\n \"RegionId\":{\n \"type\":\"String\",\n \"desc\":\"the region of aliyun mns.\",\n \"required\":true,\n \"defaultValue\":\"\"\n },\n \"QueueName\":{\n \"type\":\"String\",\n \"desc\":\"the queue name of aliyun mns.\",\n \"required\":true,\n \"defaultValue\":\"\"\n [...]
diff --git a/adapter/persistence/src/main/resources/db/h2-migration/V5__register_target_acs_dingtalk.sql b/adapter/persistence/src/main/resources/db/h2-migration/V5__register_target_acs_dingtalk.sql
deleted file mode 100644
index 1d8a643..0000000
--- a/adapter/persistence/src/main/resources/db/h2-migration/V5__register_target_acs_dingtalk.sql
+++ /dev/null
@@ -1,20 +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.
- */
-
-INSERT INTO `event_target_class` (`name`,`api_params`,`target_transform`,`required_params`,`visual_config`,`description`,`gmt_create`,`gmt_modify`)
-VALUES
-('acs.dingtalk','{\n \"WebHook\":{\n \"type\":\"String\",\n \"desc\":\"the endpoint of webhook.\",\n \"required\":true\n },\n \"SecretKey\":{\n \"type\":\"String\",\n \"desc\":\"the secret key.\",\n \"required\":true\n },\n \"Body\":{\n \"type\":\"boolean\",\n \"desc\":\"the content of request\"\n }\n}','{ \"data\":\"${Body}\" }','{\n \"webHook\":\"${WebHook}\",\n \"secretKey\":\"${SecretKey}\",\n \"cl [...]
\ No newline at end of file
diff --git a/adapter/persistence/src/main/resources/db/h2-migration/V6__register_target_acs_eventbridge.sql b/adapter/persistence/src/main/resources/db/h2-migration/V6__register_target_acs_eventbridge.sql
deleted file mode 100644
index b7587a0..0000000
--- a/adapter/persistence/src/main/resources/db/h2-migration/V6__register_target_acs_eventbridge.sql
+++ /dev/null
@@ -1,20 +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.
- */
-
-INSERT INTO `event_target_class` (`name`,`api_params`,`target_transform`,`required_params`,`visual_config`,`description`,`gmt_create`,`gmt_modify`)
-VALUES
-('acs.eventbridge','{\n \"RegionId\":{\n \"type\":\"String\",\n \"desc\":\"the region of aliyun eventbridge.\",\n \"required\":true\n },\n \"AliyunAccountId\":{\n \"type\":\"String\",\n \"desc\":\"the account id of aliyun eventbridge.\",\n \"required\":true\n },\n \"AliyunEventBus\":{\n \"type\":\"String\",\n \"desc\":\"the bus of aliyun eventbridge.\",\n \"required\":true\n },\n \"AccessKeyId\":{\n [...]
diff --git a/adapter/persistence/src/main/resources/db/h2-migration/V7__update_event_connection_table_structure.sql b/adapter/persistence/src/main/resources/db/h2-migration/V7__update_event_connection_table_structure.sql
deleted file mode 100644
index e98bbf0..0000000
--- a/adapter/persistence/src/main/resources/db/h2-migration/V7__update_event_connection_table_structure.sql
+++ /dev/null
@@ -1,19 +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.
- */
-
---ALTER TABLE `event_connection` MODIFY COLUMN `authorization_type` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '授权类型' AFTER `name`;
---ALTER TABLE `event_connection` MODIFY COLUMN `auth_parameters` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER `authorization_type`;
\ No newline at end of file
diff --git a/adapter/persistence/src/main/resources/db/h2-migration/V8__update_unique_key.sql b/adapter/persistence/src/main/resources/db/h2-migration/V8__update_unique_key.sql
deleted file mode 100644
index 2e9098e..0000000
--- a/adapter/persistence/src/main/resources/db/h2-migration/V8__update_unique_key.sql
+++ /dev/null
@@ -1,22 +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.
- */
-
-ALTER TABLE `event_connection` DROP INDEX `name_uniq_key_event_connection`;
-ALTER TABLE `event_connection` ADD UNIQUE INDEX `name_uniq_key_event_connection`(`name`, `account_id`) USING BTREE;
-
-ALTER TABLE `event_api_destination` DROP INDEX `name_uniq_key_event_api_destination`;
-ALTER TABLE `event_api_destination` ADD UNIQUE INDEX `name_uniq_key_event_api_destination`(`name`, `account_id`) USING BTREE;
\ No newline at end of file
diff --git a/adapter/persistence/src/main/resources/db/migration/V1__baseline.sql b/adapter/persistence/src/main/resources/db/migration/V1__baseline.sql
index e301d56..3909293 100644
--- a/adapter/persistence/src/main/resources/db/migration/V1__baseline.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V1__baseline.sql
@@ -1,17 +1,19 @@
-# 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.
+/*
+ * 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.
+ */
CREATE TABLE IF NOT EXISTS `event_bus` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
@@ -21,145 +23,143 @@ CREATE TABLE IF NOT EXISTS `event_bus` (
`gmt_create` datetime DEFAULT NULL COMMENT 'create time',
`gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`account_id`,`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event bus meta'
-;
+ UNIQUE KEY `name_uniq_key_event_bus` (`account_id`,`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-CREATE TABLE `event_topic` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `name` varchar(255) NOT NULL COMMENT 'topic name',
- `msg_ttl` int(11) NOT NULL COMMENT 'msg ttl',
- `cluster` varchar(255) NOT NULL COMMENT 'the cluster of topic',
- `status` tinyint(4) NOT NULL COMMENT '0:disable, 1:enable',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-;
+CREATE TABLE IF NOT EXISTS `event_topic` (
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id',
+ `bus` varchar(255) NOT NULL COMMENT 'bus name',
+ `name` varchar(255) NOT NULL COMMENT 'topic name',
+ `msg_ttl` int(11) NOT NULL COMMENT 'msg ttl',
+ `cluster` varchar(255) NOT NULL COMMENT 'the cluster of topic',
+ `status` tinyint(4) NOT NULL COMMENT '0:disable, 1:enable',
+ `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
+ `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name_uniq_key_event_topicdd` (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `event_source` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'source name',
- `status` int(11) NOT NULL DEFAULT '0' COMMENT '0:disable, 1:enable',
- `type` int(11) NOT NULL DEFAULT '1' COMMENT 'event source type',
- `class_name` varchar(255) COMMENT 'event source class name',
- `config` text COMMENT 'event source runner config',
- `description` varchar(1024) DEFAULT NULL COMMENT 'event source description',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`account_id`,`name`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event source meta'
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id',
+ `bus` varchar(255) NOT NULL COMMENT 'bus name',
+ `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'source name',
+ `status` int(11) NOT NULL DEFAULT '0' COMMENT '0:disable, 1:enable',
+ `type` int(11) NOT NULL DEFAULT '1' COMMENT 'event source type',
+ `class_name` varchar(255) COMMENT 'event source class name',
+ `config` text COMMENT 'event source runner config',
+ `description` varchar(1024) DEFAULT NULL COMMENT 'event source description',
+ `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
+ `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name_uniq_key_event_source` (`account_id`,`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
CREATE TABLE IF NOT EXISTS `event_type` (
- `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) NOT NULL COMMENT 'bus account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `source` varchar(255) NOT NULL DEFAULT '' COMMENT 'event source name',
- `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'event type name',
- `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event type',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`source`,`name`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event type meta'
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `account_id` varchar(255) NOT NULL COMMENT 'bus account id',
+ `bus` varchar(255) NOT NULL COMMENT 'bus name',
+ `source` varchar(255) NOT NULL DEFAULT '' COMMENT 'event source name',
+ `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'event type name',
+ `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event type',
+ `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
+ `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name_uniq_key_event_type` (`source`,`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
CREATE TABLE IF NOT EXISTS `event_rule` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) NOT NULL COMMENT 'bus account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `name` varchar(255) NOT NULL COMMENT 'rule name',
- `filter_pattern` varchar(4096) DEFAULT NULL COMMENT 'event filter pattern',
- `status` tinyint(4) NOT NULL COMMENT '0:disable, 1:enable',
- `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event rule',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- UNIQUE KEY `id` (`id`),
- UNIQUE KEY `name_uniq_key` (`account_id`,`name`,`bus`)
- ) ENGINE=InnoDB AUTO_INCREMENT=51815 DEFAULT CHARSET=utf8 COMMENT='event rule meta'
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `account_id` varchar(255) NOT NULL COMMENT 'bus account id',
+ `bus` varchar(255) NOT NULL COMMENT 'bus name',
+ `name` varchar(255) NOT NULL COMMENT 'rule name',
+ `filter_pattern` varchar(4096) DEFAULT NULL COMMENT 'event filter pattern',
+ `status` tinyint(4) NOT NULL COMMENT '0:disable, 1:enable',
+ `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event rule',
+ `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
+ `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
+ UNIQUE KEY `id` (`id`),
+ UNIQUE KEY `name_uniq_key_event_rule` (`account_id`,`name`,`bus`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
CREATE TABLE IF NOT EXISTS `event_source_runner` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `source` varchar(255) NOT NULL DEFAULT '' COMMENT 'source name',
- `run_options` varchar(1024) DEFAULT NULL COMMENT 'event source runner options',
- `run_context` varchar(1024) DEFAULT NULL COMMENT 'event source running context',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`account_id`,`bus`,`source`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event source runner meta'
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id',
+ `bus` varchar(255) NOT NULL COMMENT 'bus name',
+ `source` varchar(255) NOT NULL DEFAULT '' COMMENT 'source name',
+ `run_options` varchar(1024) DEFAULT NULL COMMENT 'event source runner options',
+ `run_context` varchar(1024) DEFAULT NULL COMMENT 'event source running context',
+ `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
+ `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name_uniq_key_event_source_runner` (`account_id`,`bus`,`source`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
CREATE TABLE IF NOT EXISTS `event_target` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'target account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `rule` varchar(255) NOT NULL DEFAULT '' COMMENT 'rule name',
- `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'target name',
- `class_name` varchar(255) NOT NULL COMMENT 'event target class name',
- `config` text NOT NULL COMMENT 'event target runner config',
- `run_options` varchar(1024) DEFAULT NULL COMMENT 'event target runner options',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`account_id`,`bus`,`rule`,`name`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event target meta'
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'target account id',
+ `bus` varchar(255) NOT NULL COMMENT 'bus name',
+ `rule` varchar(255) NOT NULL DEFAULT '' COMMENT 'rule name',
+ `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'target name',
+ `class_name` varchar(255) NOT NULL COMMENT 'event target class name',
+ `config` text NOT NULL COMMENT 'event target runner config',
+ `run_options` varchar(1024) DEFAULT NULL COMMENT 'event target runner options',
+ `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
+ `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name_uniq_key_event_target` (`account_id`,`bus`,`rule`,`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
CREATE TABLE IF NOT EXISTS `event_target_runner` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'target account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `rule` varchar(255) NOT NULL DEFAULT '' COMMENT 'rule name',
- `target` varchar(255) NOT NULL DEFAULT '' COMMENT 'target name',
- `run_context` varchar(1024) DEFAULT NULL COMMENT 'event target running context',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`account_id`,`bus`,`rule`,`target`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event target runner meta'
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'target account id',
+ `bus` varchar(255) NOT NULL COMMENT 'bus name',
+ `rule` varchar(255) NOT NULL DEFAULT '' COMMENT 'rule name',
+ `target` varchar(255) NOT NULL DEFAULT '' COMMENT 'target name',
+ `run_context` varchar(1024) DEFAULT NULL COMMENT 'event target running context',
+ `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
+ `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name_uniq_key_event_target_runner` (`account_id`,`bus`,`rule`,`target`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
CREATE TABLE IF NOT EXISTS `event_source_class` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'source class name',
- `api_params` text NOT NULL COMMENT 'event source api params',
- `required_params` text NOT NULL COMMENT 'event source required params',
- `transform` text NOT NULL COMMENT 'transform the event source data',
- `visual_config` text DEFAULT NULL COMMENT 'event source fore-end visual config',
- `description` varchar(255) DEFAULT NULL COMMENT 'a description about the source class',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`name`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event source class meta'
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'source class name',
+ `api_params` text NOT NULL COMMENT 'event source api params',
+ `required_params` text NOT NULL COMMENT 'event source required params',
+ `transform` text NOT NULL COMMENT 'transform the event source data',
+ `visual_config` text DEFAULT NULL COMMENT 'event source fore-end visual config',
+ `description` varchar(255) DEFAULT NULL COMMENT 'a description about the source class',
+ `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
+ `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name_uniq_key_event_source_class` (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
CREATE TABLE IF NOT EXISTS `event_target_class` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'target class name',
- `api_params` text NOT NULL COMMENT 'event target api params',
- `target_transform` text NOT NULL COMMENT 'event target required data',
- `required_params` text NOT NULL COMMENT 'event target required params',
- `visual_config` text DEFAULT NULL COMMENT 'event target fore-end visual config',
- `description` varchar(255) DEFAULT NULL COMMENT 'a description about the target class',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`name`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event target class meta'
-;
\ No newline at end of file
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'target class name',
+ `api_params` text NOT NULL COMMENT 'event target api params',
+ `target_transform` text NOT NULL COMMENT 'event target required data',
+ `required_params` text NOT NULL COMMENT 'event target required params',
+ `visual_config` text DEFAULT NULL COMMENT 'event target fore-end visual config',
+ `description` varchar(255) DEFAULT NULL COMMENT 'a description about the target class',
+ `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
+ `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name_uniq_key_event_target_class` (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
+;
diff --git a/adapter/persistence/src/main/resources/db/migration/V2__baseline.sql b/adapter/persistence/src/main/resources/db/migration/V2__baseline.sql
index a8a8c62..d17561a 100644
--- a/adapter/persistence/src/main/resources/db/migration/V2__baseline.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V2__baseline.sql
@@ -1,32 +1,34 @@
-# 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.
+/*
+ * 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.
+ */
CREATE TABLE IF NOT EXISTS `event_connection` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`account_id` varchar(255) NOT NULL COMMENT 'event_connection account id',
`name` varchar(128) NOT NULL DEFAULT '' COMMENT '名称',
- `authorization_type` varchar(128) DEFAULT NULL COMMENT '授权类型',
- `auth_parameters` text DEFAULT NULL COMMENT '',
+ `authorization_type` varchar(128) NULL DEFAULT '' COMMENT '授权类型',
+ `auth_parameters` text NULL DEFAULT NULL COMMENT '',
`network_type` varchar(128) NOT NULL DEFAULT '' COMMENT '网络类型',
`network_parameters` text DEFAULT NULL COMMENT '网络配置',
`description` varchar(255) DEFAULT NULL COMMENT 'a description about the event_connection',
`gmt_create` datetime DEFAULT NULL COMMENT 'create time',
`gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`name`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event connection meta'
+ UNIQUE KEY `name_uniq_key_event_connection` (`name`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
@@ -42,6 +44,6 @@ CREATE TABLE IF NOT EXISTS `event_api_destination` (
`gmt_create` datetime DEFAULT NULL COMMENT 'create time',
`gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key` (`name`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event api destination meta'
-;
\ No newline at end of file
+ UNIQUE KEY `name_uniq_key_event_api_destination` (`name`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8
+;
diff --git a/adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql b/adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql
index 6c872c9..b2a18c2 100644
--- a/adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql
@@ -1,17 +1,19 @@
-# 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.
+/*
+ * 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.
+ */
ALTER TABLE `event_target_class`
-CHANGE COLUMN `target_transform` `target_transform` TEXT NULL DEFAULT NULL ;
\ No newline at end of file
+CHANGE COLUMN `target_transform` `target_transform` TEXT NULL DEFAULT NULL ;
diff --git a/adapter/persistence/src/main/resources/db/migration/V4__register_source_acs_mns.sql b/adapter/persistence/src/main/resources/db/migration/V4__register_source_acs_mns.sql
index 7bc4cfc..1ad499a 100644
--- a/adapter/persistence/src/main/resources/db/migration/V4__register_source_acs_mns.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V4__register_source_acs_mns.sql
@@ -1,16 +1,18 @@
-# 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.
+/*
+ * 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.
+ */
-INSERT INTO `event_source_class` (`name`,`api_params`,`required_params`,`transform`,`visual_config`,`description`,`gmt_create`,`gmt_modify`) VALUES ('acs.mns','{\n \"RegionId\":{\n \"type\":\"String\",\n \"desc\":\"the region of aliyun mns.\",\n \"required\":true,\n \"defaultValue\":\"\"\n },\n \"QueueName\":{\n \"type\":\"String\",\n \"desc\":\"the queue name of aliyun mns.\",\n \"required\":true,\n \"defaultValue\":\"\"\n [...]
\ No newline at end of file
+INSERT INTO `event_source_class` (`name`,`api_params`,`required_params`,`transform`,`visual_config`,`description`,`gmt_create`,`gmt_modify`) VALUES ('acs.mns','{\n \"RegionId\":{\n \"type\":\"String\",\n \"desc\":\"the region of aliyun mns.\",\n \"required\":true,\n \"defaultValue\":\"\"\n },\n \"QueueName\":{\n \"type\":\"String\",\n \"desc\":\"the queue name of aliyun mns.\",\n \"required\":true,\n \"defaultValue\":\"\"\n [...]
diff --git a/adapter/persistence/src/main/resources/db/migration/V5__register_target_acs_dingtalk.sql b/adapter/persistence/src/main/resources/db/migration/V5__register_target_acs_dingtalk.sql
index 31291a1..1d8a643 100644
--- a/adapter/persistence/src/main/resources/db/migration/V5__register_target_acs_dingtalk.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V5__register_target_acs_dingtalk.sql
@@ -1,17 +1,19 @@
-# 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.
+/*
+ * 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.
+ */
INSERT INTO `event_target_class` (`name`,`api_params`,`target_transform`,`required_params`,`visual_config`,`description`,`gmt_create`,`gmt_modify`)
VALUES
diff --git a/adapter/persistence/src/main/resources/db/migration/V6__register_target_acs_eventbridge.sql b/adapter/persistence/src/main/resources/db/migration/V6__register_target_acs_eventbridge.sql
index 9a38fe6..b7587a0 100644
--- a/adapter/persistence/src/main/resources/db/migration/V6__register_target_acs_eventbridge.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V6__register_target_acs_eventbridge.sql
@@ -1,18 +1,20 @@
-# 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.
+/*
+ * 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.
+ */
INSERT INTO `event_target_class` (`name`,`api_params`,`target_transform`,`required_params`,`visual_config`,`description`,`gmt_create`,`gmt_modify`)
VALUES
-('acs.eventbridge','{\n \"RegionId\":{\n \"type\":\"String\",\n \"desc\":\"the region of aliyun eventbridge.\",\n \"required\":true\n },\n \"AliyunAccountId\":{\n \"type\":\"String\",\n \"desc\":\"the account id of aliyun eventbridge.\",\n \"required\":true\n },\n \"AliyunEventBus\":{\n \"type\":\"String\",\n \"desc\":\"the bus of aliyun eventbridge.\",\n \"required\":true\n },\n \"AccessKeyId\":{\n [...]
\ No newline at end of file
+('acs.eventbridge','{\n \"RegionId\":{\n \"type\":\"String\",\n \"desc\":\"the region of aliyun eventbridge.\",\n \"required\":true\n },\n \"AliyunAccountId\":{\n \"type\":\"String\",\n \"desc\":\"the account id of aliyun eventbridge.\",\n \"required\":true\n },\n \"AliyunEventBus\":{\n \"type\":\"String\",\n \"desc\":\"the bus of aliyun eventbridge.\",\n \"required\":true\n },\n \"AccessKeyId\":{\n [...]
diff --git a/adapter/persistence/src/main/resources/db/migration/V7__update_event_connection_table_structure.sql b/adapter/persistence/src/main/resources/db/migration/V7__update_event_connection_table_structure.sql
index 82be349..e98bbf0 100644
--- a/adapter/persistence/src/main/resources/db/migration/V7__update_event_connection_table_structure.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V7__update_event_connection_table_structure.sql
@@ -1,18 +1,19 @@
-# 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.
+/*
+ * 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.
+ */
-ALTER TABLE `event_connection`
-MODIFY COLUMN `authorization_type` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '授权类型' AFTER `name`,
-MODIFY COLUMN `auth_parameters` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER `authorization_type`;
\ No newline at end of file
+--ALTER TABLE `event_connection` MODIFY COLUMN `authorization_type` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '授权类型' AFTER `name`;
+--ALTER TABLE `event_connection` MODIFY COLUMN `auth_parameters` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER `authorization_type`;
\ No newline at end of file
diff --git a/adapter/persistence/src/main/resources/db/migration/V8__update_unique_key.sql b/adapter/persistence/src/main/resources/db/migration/V8__update_unique_key.sql
index f25bfb0..2e9098e 100644
--- a/adapter/persistence/src/main/resources/db/migration/V8__update_unique_key.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V8__update_unique_key.sql
@@ -1,22 +1,22 @@
-# 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.
+/*
+ * 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.
+ */
-ALTER TABLE `event_connection`
-DROP INDEX `name_uniq_key`,
-ADD UNIQUE INDEX `name_uniq_key`(`name`, `account_id`) USING BTREE;
+ALTER TABLE `event_connection` DROP INDEX `name_uniq_key_event_connection`;
+ALTER TABLE `event_connection` ADD UNIQUE INDEX `name_uniq_key_event_connection`(`name`, `account_id`) USING BTREE;
-ALTER TABLE `event_api_destination`
-DROP INDEX `name_uniq_key`,
-ADD UNIQUE INDEX `name_uniq_key`(`name`, `account_id`) USING BTREE;
\ No newline at end of file
+ALTER TABLE `event_api_destination` DROP INDEX `name_uniq_key_event_api_destination`;
+ALTER TABLE `event_api_destination` ADD UNIQUE INDEX `name_uniq_key_event_api_destination`(`name`, `account_id`) USING BTREE;
\ No newline at end of file
diff --git a/docs/cn/RocketMQEventBridgeDatabaseUsage.md b/docs/cn/RocketMQEventBridgeDatabaseUsage.md
index 99e7bf8..d5b159f 100644
--- a/docs/cn/RocketMQEventBridgeDatabaseUsage.md
+++ b/docs/cn/RocketMQEventBridgeDatabaseUsage.md
@@ -7,16 +7,18 @@ RocketMQ EventBridge 使用数据库存储运行过程中定义的规则
* 内置数据库h2,主要方便进行本地测试和快速开始
* mysql数据库,实际生产部署时可以使用
-### 内置数据库
+### 内置数据库H2
+#### H2介绍
+H2是一个使用Java实现的内存数据库,支持标准的SQL语法,支持大部分的MySQL语法和函数
+
```properties
# 是否开启本地页面访问
spring.profiles.active=local
-# h2 sql migration所在目录
-spring.flyway.locations=classpath:db/h2-migration
```
-本地运行后,访问h2数据库。访问url: localhost:8083:
+本地运行后,访问h2数据库。访问url: localhost:8083,用户名/密码: sa/sa:

+
### mysql数据库
```properties
## database
@@ -24,6 +26,4 @@ spring.datasource.hikari.jdbc-url=jdbc:mysql://localhost:3306/eventBridge?useUni
spring.datasource.hikari.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.hikari.username=xxxxx
spring.datasource.hikari.password=xxxxx
-# 注释h2使用的sql migration
-#spring.flyway.locations=classpath:db/h2-migration
```
\ No newline at end of file
diff --git a/start/src/main/resources/application.properties b/start/src/main/resources/application.properties
index 62daed6..3736814 100644
--- a/start/src/main/resources/application.properties
+++ b/start/src/main/resources/application.properties
@@ -25,7 +25,6 @@ spring.profiles.active=local
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
## flyway
spring.flyway.placeholderReplacement=false
-spring.flyway.locations=classpath:db/h2-migration
## rocketmq
rocketmq.namesrvAddr=localhost:9876
rocketmq.connect.endpoint=http://127.0.0.1:8082
[rocketmq-eventbridge] 02/04: 1.add h2 db migration file directory
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
shenlin pushed a commit to branch runtimer
in repository https://gitbox.apache.org/repos/asf/rocketmq-eventbridge.git
commit b634ba975aa0c77af4c456f7bbe5f3207d29cca3
Author: wangkai <wa...@zhongan.com>
AuthorDate: Mon Jun 5 11:02:39 2023 +0800
1.add h2 db migration file directory
---
.../{migration => h2-migration}/V1__baseline.sql | 0
.../{migration => h2-migration}/V2__baseline.sql | 0
.../V3__change_target_transform_type.sql | 0
.../V4__register_source_acs_mns.sql | 0
.../V5__register_target_acs_dingtalk.sql | 0
.../V6__register_target_acs_eventbridge.sql | 0
...V7__update_event_connection_table_structure.sql | 0
.../V8__update_unique_key.sql | 0
.../main/resources/db/migration/V1__baseline.sql | 256 ++++++++++-----------
.../main/resources/db/migration/V2__baseline.sql | 40 ++--
.../migration/V3__change_target_transform_type.sql | 32 ++-
.../db/migration/V4__register_source_acs_mns.sql | 32 ++-
.../migration/V5__register_target_acs_dingtalk.sql | 30 ++-
.../V6__register_target_acs_eventbridge.sql | 32 ++-
...V7__update_event_connection_table_structure.sql | 35 ++-
.../db/migration/V8__update_unique_key.sql | 40 ++--
start/src/main/resources/application.properties | 1 +
17 files changed, 244 insertions(+), 254 deletions(-)
diff --git a/adapter/persistence/src/main/resources/db/migration/V1__baseline.sql b/adapter/persistence/src/main/resources/db/h2-migration/V1__baseline.sql
similarity index 100%
copy from adapter/persistence/src/main/resources/db/migration/V1__baseline.sql
copy to adapter/persistence/src/main/resources/db/h2-migration/V1__baseline.sql
diff --git a/adapter/persistence/src/main/resources/db/migration/V2__baseline.sql b/adapter/persistence/src/main/resources/db/h2-migration/V2__baseline.sql
similarity index 100%
copy from adapter/persistence/src/main/resources/db/migration/V2__baseline.sql
copy to adapter/persistence/src/main/resources/db/h2-migration/V2__baseline.sql
diff --git a/adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql b/adapter/persistence/src/main/resources/db/h2-migration/V3__change_target_transform_type.sql
similarity index 100%
copy from adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql
copy to adapter/persistence/src/main/resources/db/h2-migration/V3__change_target_transform_type.sql
diff --git a/adapter/persistence/src/main/resources/db/migration/V4__register_source_acs_mns.sql b/adapter/persistence/src/main/resources/db/h2-migration/V4__register_source_acs_mns.sql
similarity index 100%
copy from adapter/persistence/src/main/resources/db/migration/V4__register_source_acs_mns.sql
copy to adapter/persistence/src/main/resources/db/h2-migration/V4__register_source_acs_mns.sql
diff --git a/adapter/persistence/src/main/resources/db/migration/V5__register_target_acs_dingtalk.sql b/adapter/persistence/src/main/resources/db/h2-migration/V5__register_target_acs_dingtalk.sql
similarity index 100%
copy from adapter/persistence/src/main/resources/db/migration/V5__register_target_acs_dingtalk.sql
copy to adapter/persistence/src/main/resources/db/h2-migration/V5__register_target_acs_dingtalk.sql
diff --git a/adapter/persistence/src/main/resources/db/migration/V6__register_target_acs_eventbridge.sql b/adapter/persistence/src/main/resources/db/h2-migration/V6__register_target_acs_eventbridge.sql
similarity index 100%
copy from adapter/persistence/src/main/resources/db/migration/V6__register_target_acs_eventbridge.sql
copy to adapter/persistence/src/main/resources/db/h2-migration/V6__register_target_acs_eventbridge.sql
diff --git a/adapter/persistence/src/main/resources/db/migration/V7__update_event_connection_table_structure.sql b/adapter/persistence/src/main/resources/db/h2-migration/V7__update_event_connection_table_structure.sql
similarity index 100%
copy from adapter/persistence/src/main/resources/db/migration/V7__update_event_connection_table_structure.sql
copy to adapter/persistence/src/main/resources/db/h2-migration/V7__update_event_connection_table_structure.sql
diff --git a/adapter/persistence/src/main/resources/db/migration/V8__update_unique_key.sql b/adapter/persistence/src/main/resources/db/h2-migration/V8__update_unique_key.sql
similarity index 100%
copy from adapter/persistence/src/main/resources/db/migration/V8__update_unique_key.sql
copy to adapter/persistence/src/main/resources/db/h2-migration/V8__update_unique_key.sql
diff --git a/adapter/persistence/src/main/resources/db/migration/V1__baseline.sql b/adapter/persistence/src/main/resources/db/migration/V1__baseline.sql
index 3909293..e301d56 100644
--- a/adapter/persistence/src/main/resources/db/migration/V1__baseline.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V1__baseline.sql
@@ -1,19 +1,17 @@
-/*
- * 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.
- */
+# 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.
CREATE TABLE IF NOT EXISTS `event_bus` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
@@ -23,143 +21,145 @@ CREATE TABLE IF NOT EXISTS `event_bus` (
`gmt_create` datetime DEFAULT NULL COMMENT 'create time',
`gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_bus` (`account_id`,`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+ UNIQUE KEY `name_uniq_key` (`account_id`,`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event bus meta'
+;
-CREATE TABLE IF NOT EXISTS `event_topic` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `name` varchar(255) NOT NULL COMMENT 'topic name',
- `msg_ttl` int(11) NOT NULL COMMENT 'msg ttl',
- `cluster` varchar(255) NOT NULL COMMENT 'the cluster of topic',
- `status` tinyint(4) NOT NULL COMMENT '0:disable, 1:enable',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_topicdd` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE `event_topic` (
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id',
+ `bus` varchar(255) NOT NULL COMMENT 'bus name',
+ `name` varchar(255) NOT NULL COMMENT 'topic name',
+ `msg_ttl` int(11) NOT NULL COMMENT 'msg ttl',
+ `cluster` varchar(255) NOT NULL COMMENT 'the cluster of topic',
+ `status` tinyint(4) NOT NULL COMMENT '0:disable, 1:enable',
+ `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
+ `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name_uniq_key` (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
+;
CREATE TABLE IF NOT EXISTS `event_source` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'source name',
- `status` int(11) NOT NULL DEFAULT '0' COMMENT '0:disable, 1:enable',
- `type` int(11) NOT NULL DEFAULT '1' COMMENT 'event source type',
- `class_name` varchar(255) COMMENT 'event source class name',
- `config` text COMMENT 'event source runner config',
- `description` varchar(1024) DEFAULT NULL COMMENT 'event source description',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_source` (`account_id`,`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id',
+ `bus` varchar(255) NOT NULL COMMENT 'bus name',
+ `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'source name',
+ `status` int(11) NOT NULL DEFAULT '0' COMMENT '0:disable, 1:enable',
+ `type` int(11) NOT NULL DEFAULT '1' COMMENT 'event source type',
+ `class_name` varchar(255) COMMENT 'event source class name',
+ `config` text COMMENT 'event source runner config',
+ `description` varchar(1024) DEFAULT NULL COMMENT 'event source description',
+ `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
+ `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name_uniq_key` (`account_id`,`name`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event source meta'
;
CREATE TABLE IF NOT EXISTS `event_type` (
- `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) NOT NULL COMMENT 'bus account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `source` varchar(255) NOT NULL DEFAULT '' COMMENT 'event source name',
- `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'event type name',
- `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event type',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_type` (`source`,`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `account_id` varchar(255) NOT NULL COMMENT 'bus account id',
+ `bus` varchar(255) NOT NULL COMMENT 'bus name',
+ `source` varchar(255) NOT NULL DEFAULT '' COMMENT 'event source name',
+ `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'event type name',
+ `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event type',
+ `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
+ `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name_uniq_key` (`source`,`name`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event type meta'
;
CREATE TABLE IF NOT EXISTS `event_rule` (
- `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) NOT NULL COMMENT 'bus account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `name` varchar(255) NOT NULL COMMENT 'rule name',
- `filter_pattern` varchar(4096) DEFAULT NULL COMMENT 'event filter pattern',
- `status` tinyint(4) NOT NULL COMMENT '0:disable, 1:enable',
- `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event rule',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- UNIQUE KEY `id` (`id`),
- UNIQUE KEY `name_uniq_key_event_rule` (`account_id`,`name`,`bus`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `account_id` varchar(255) NOT NULL COMMENT 'bus account id',
+ `bus` varchar(255) NOT NULL COMMENT 'bus name',
+ `name` varchar(255) NOT NULL COMMENT 'rule name',
+ `filter_pattern` varchar(4096) DEFAULT NULL COMMENT 'event filter pattern',
+ `status` tinyint(4) NOT NULL COMMENT '0:disable, 1:enable',
+ `description` varchar(255) DEFAULT NULL COMMENT 'a description about the event rule',
+ `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
+ `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
+ UNIQUE KEY `id` (`id`),
+ UNIQUE KEY `name_uniq_key` (`account_id`,`name`,`bus`)
+ ) ENGINE=InnoDB AUTO_INCREMENT=51815 DEFAULT CHARSET=utf8 COMMENT='event rule meta'
;
CREATE TABLE IF NOT EXISTS `event_source_runner` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `source` varchar(255) NOT NULL DEFAULT '' COMMENT 'source name',
- `run_options` varchar(1024) DEFAULT NULL COMMENT 'event source runner options',
- `run_context` varchar(1024) DEFAULT NULL COMMENT 'event source running context',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_source_runner` (`account_id`,`bus`,`source`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'source account id',
+ `bus` varchar(255) NOT NULL COMMENT 'bus name',
+ `source` varchar(255) NOT NULL DEFAULT '' COMMENT 'source name',
+ `run_options` varchar(1024) DEFAULT NULL COMMENT 'event source runner options',
+ `run_context` varchar(1024) DEFAULT NULL COMMENT 'event source running context',
+ `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
+ `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name_uniq_key` (`account_id`,`bus`,`source`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event source runner meta'
;
CREATE TABLE IF NOT EXISTS `event_target` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'target account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `rule` varchar(255) NOT NULL DEFAULT '' COMMENT 'rule name',
- `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'target name',
- `class_name` varchar(255) NOT NULL COMMENT 'event target class name',
- `config` text NOT NULL COMMENT 'event target runner config',
- `run_options` varchar(1024) DEFAULT NULL COMMENT 'event target runner options',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_target` (`account_id`,`bus`,`rule`,`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'target account id',
+ `bus` varchar(255) NOT NULL COMMENT 'bus name',
+ `rule` varchar(255) NOT NULL DEFAULT '' COMMENT 'rule name',
+ `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'target name',
+ `class_name` varchar(255) NOT NULL COMMENT 'event target class name',
+ `config` text NOT NULL COMMENT 'event target runner config',
+ `run_options` varchar(1024) DEFAULT NULL COMMENT 'event target runner options',
+ `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
+ `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name_uniq_key` (`account_id`,`bus`,`rule`,`name`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event target meta'
;
CREATE TABLE IF NOT EXISTS `event_target_runner` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'target account id',
- `bus` varchar(255) NOT NULL COMMENT 'bus name',
- `rule` varchar(255) NOT NULL DEFAULT '' COMMENT 'rule name',
- `target` varchar(255) NOT NULL DEFAULT '' COMMENT 'target name',
- `run_context` varchar(1024) DEFAULT NULL COMMENT 'event target running context',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_target_runner` (`account_id`,`bus`,`rule`,`target`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `account_id` varchar(255) DEFAULT 'SYSTEM' COMMENT 'target account id',
+ `bus` varchar(255) NOT NULL COMMENT 'bus name',
+ `rule` varchar(255) NOT NULL DEFAULT '' COMMENT 'rule name',
+ `target` varchar(255) NOT NULL DEFAULT '' COMMENT 'target name',
+ `run_context` varchar(1024) DEFAULT NULL COMMENT 'event target running context',
+ `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
+ `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name_uniq_key` (`account_id`,`bus`,`rule`,`target`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event target runner meta'
;
CREATE TABLE IF NOT EXISTS `event_source_class` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'source class name',
- `api_params` text NOT NULL COMMENT 'event source api params',
- `required_params` text NOT NULL COMMENT 'event source required params',
- `transform` text NOT NULL COMMENT 'transform the event source data',
- `visual_config` text DEFAULT NULL COMMENT 'event source fore-end visual config',
- `description` varchar(255) DEFAULT NULL COMMENT 'a description about the source class',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_source_class` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'source class name',
+ `api_params` text NOT NULL COMMENT 'event source api params',
+ `required_params` text NOT NULL COMMENT 'event source required params',
+ `transform` text NOT NULL COMMENT 'transform the event source data',
+ `visual_config` text DEFAULT NULL COMMENT 'event source fore-end visual config',
+ `description` varchar(255) DEFAULT NULL COMMENT 'a description about the source class',
+ `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
+ `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name_uniq_key` (`name`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event source class meta'
;
CREATE TABLE IF NOT EXISTS `event_target_class` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'target class name',
- `api_params` text NOT NULL COMMENT 'event target api params',
- `target_transform` text NOT NULL COMMENT 'event target required data',
- `required_params` text NOT NULL COMMENT 'event target required params',
- `visual_config` text DEFAULT NULL COMMENT 'event target fore-end visual config',
- `description` varchar(255) DEFAULT NULL COMMENT 'a description about the target class',
- `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
- `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_target_class` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-;
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'target class name',
+ `api_params` text NOT NULL COMMENT 'event target api params',
+ `target_transform` text NOT NULL COMMENT 'event target required data',
+ `required_params` text NOT NULL COMMENT 'event target required params',
+ `visual_config` text DEFAULT NULL COMMENT 'event target fore-end visual config',
+ `description` varchar(255) DEFAULT NULL COMMENT 'a description about the target class',
+ `gmt_create` datetime DEFAULT NULL COMMENT 'create time',
+ `gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name_uniq_key` (`name`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event target class meta'
+;
\ No newline at end of file
diff --git a/adapter/persistence/src/main/resources/db/migration/V2__baseline.sql b/adapter/persistence/src/main/resources/db/migration/V2__baseline.sql
index c70912c..a8a8c62 100644
--- a/adapter/persistence/src/main/resources/db/migration/V2__baseline.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V2__baseline.sql
@@ -1,19 +1,17 @@
-/*
- * 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.
- */
+# 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.
CREATE TABLE IF NOT EXISTS `event_connection` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
@@ -27,8 +25,8 @@ CREATE TABLE IF NOT EXISTS `event_connection` (
`gmt_create` datetime DEFAULT NULL COMMENT 'create time',
`gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_connection` (`name`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8
+ UNIQUE KEY `name_uniq_key` (`name`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event connection meta'
;
@@ -44,6 +42,6 @@ CREATE TABLE IF NOT EXISTS `event_api_destination` (
`gmt_create` datetime DEFAULT NULL COMMENT 'create time',
`gmt_modify` datetime DEFAULT NULL COMMENT 'modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `name_uniq_key_event_api_destination` (`name`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8
-;
+ UNIQUE KEY `name_uniq_key` (`name`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='event api destination meta'
+;
\ No newline at end of file
diff --git a/adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql b/adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql
index b2a18c2..6c872c9 100644
--- a/adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V3__change_target_transform_type.sql
@@ -1,19 +1,17 @@
-/*
- * 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.
- */
+# 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.
ALTER TABLE `event_target_class`
-CHANGE COLUMN `target_transform` `target_transform` TEXT NULL DEFAULT NULL ;
+CHANGE COLUMN `target_transform` `target_transform` TEXT NULL DEFAULT NULL ;
\ No newline at end of file
diff --git a/adapter/persistence/src/main/resources/db/migration/V4__register_source_acs_mns.sql b/adapter/persistence/src/main/resources/db/migration/V4__register_source_acs_mns.sql
index 1ad499a..7bc4cfc 100644
--- a/adapter/persistence/src/main/resources/db/migration/V4__register_source_acs_mns.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V4__register_source_acs_mns.sql
@@ -1,18 +1,16 @@
-/*
- * 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.
- */
+# 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.
-INSERT INTO `event_source_class` (`name`,`api_params`,`required_params`,`transform`,`visual_config`,`description`,`gmt_create`,`gmt_modify`) VALUES ('acs.mns','{\n \"RegionId\":{\n \"type\":\"String\",\n \"desc\":\"the region of aliyun mns.\",\n \"required\":true,\n \"defaultValue\":\"\"\n },\n \"QueueName\":{\n \"type\":\"String\",\n \"desc\":\"the queue name of aliyun mns.\",\n \"required\":true,\n \"defaultValue\":\"\"\n [...]
+INSERT INTO `event_source_class` (`name`,`api_params`,`required_params`,`transform`,`visual_config`,`description`,`gmt_create`,`gmt_modify`) VALUES ('acs.mns','{\n \"RegionId\":{\n \"type\":\"String\",\n \"desc\":\"the region of aliyun mns.\",\n \"required\":true,\n \"defaultValue\":\"\"\n },\n \"QueueName\":{\n \"type\":\"String\",\n \"desc\":\"the queue name of aliyun mns.\",\n \"required\":true,\n \"defaultValue\":\"\"\n [...]
\ No newline at end of file
diff --git a/adapter/persistence/src/main/resources/db/migration/V5__register_target_acs_dingtalk.sql b/adapter/persistence/src/main/resources/db/migration/V5__register_target_acs_dingtalk.sql
index 1d8a643..31291a1 100644
--- a/adapter/persistence/src/main/resources/db/migration/V5__register_target_acs_dingtalk.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V5__register_target_acs_dingtalk.sql
@@ -1,19 +1,17 @@
-/*
- * 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.
- */
+# 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.
INSERT INTO `event_target_class` (`name`,`api_params`,`target_transform`,`required_params`,`visual_config`,`description`,`gmt_create`,`gmt_modify`)
VALUES
diff --git a/adapter/persistence/src/main/resources/db/migration/V6__register_target_acs_eventbridge.sql b/adapter/persistence/src/main/resources/db/migration/V6__register_target_acs_eventbridge.sql
index b7587a0..9a38fe6 100644
--- a/adapter/persistence/src/main/resources/db/migration/V6__register_target_acs_eventbridge.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V6__register_target_acs_eventbridge.sql
@@ -1,20 +1,18 @@
-/*
- * 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.
- */
+# 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.
INSERT INTO `event_target_class` (`name`,`api_params`,`target_transform`,`required_params`,`visual_config`,`description`,`gmt_create`,`gmt_modify`)
VALUES
-('acs.eventbridge','{\n \"RegionId\":{\n \"type\":\"String\",\n \"desc\":\"the region of aliyun eventbridge.\",\n \"required\":true\n },\n \"AliyunAccountId\":{\n \"type\":\"String\",\n \"desc\":\"the account id of aliyun eventbridge.\",\n \"required\":true\n },\n \"AliyunEventBus\":{\n \"type\":\"String\",\n \"desc\":\"the bus of aliyun eventbridge.\",\n \"required\":true\n },\n \"AccessKeyId\":{\n [...]
+('acs.eventbridge','{\n \"RegionId\":{\n \"type\":\"String\",\n \"desc\":\"the region of aliyun eventbridge.\",\n \"required\":true\n },\n \"AliyunAccountId\":{\n \"type\":\"String\",\n \"desc\":\"the account id of aliyun eventbridge.\",\n \"required\":true\n },\n \"AliyunEventBus\":{\n \"type\":\"String\",\n \"desc\":\"the bus of aliyun eventbridge.\",\n \"required\":true\n },\n \"AccessKeyId\":{\n [...]
\ No newline at end of file
diff --git a/adapter/persistence/src/main/resources/db/migration/V7__update_event_connection_table_structure.sql b/adapter/persistence/src/main/resources/db/migration/V7__update_event_connection_table_structure.sql
index e98bbf0..82be349 100644
--- a/adapter/persistence/src/main/resources/db/migration/V7__update_event_connection_table_structure.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V7__update_event_connection_table_structure.sql
@@ -1,19 +1,18 @@
-/*
- * 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.
- */
+# 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.
---ALTER TABLE `event_connection` MODIFY COLUMN `authorization_type` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '授权类型' AFTER `name`;
---ALTER TABLE `event_connection` MODIFY COLUMN `auth_parameters` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER `authorization_type`;
\ No newline at end of file
+ALTER TABLE `event_connection`
+MODIFY COLUMN `authorization_type` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '授权类型' AFTER `name`,
+MODIFY COLUMN `auth_parameters` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER `authorization_type`;
\ No newline at end of file
diff --git a/adapter/persistence/src/main/resources/db/migration/V8__update_unique_key.sql b/adapter/persistence/src/main/resources/db/migration/V8__update_unique_key.sql
index 2e9098e..f25bfb0 100644
--- a/adapter/persistence/src/main/resources/db/migration/V8__update_unique_key.sql
+++ b/adapter/persistence/src/main/resources/db/migration/V8__update_unique_key.sql
@@ -1,22 +1,22 @@
-/*
- * 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.
- */
+# 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.
-ALTER TABLE `event_connection` DROP INDEX `name_uniq_key_event_connection`;
-ALTER TABLE `event_connection` ADD UNIQUE INDEX `name_uniq_key_event_connection`(`name`, `account_id`) USING BTREE;
+ALTER TABLE `event_connection`
+DROP INDEX `name_uniq_key`,
+ADD UNIQUE INDEX `name_uniq_key`(`name`, `account_id`) USING BTREE;
-ALTER TABLE `event_api_destination` DROP INDEX `name_uniq_key_event_api_destination`;
-ALTER TABLE `event_api_destination` ADD UNIQUE INDEX `name_uniq_key_event_api_destination`(`name`, `account_id`) USING BTREE;
\ No newline at end of file
+ALTER TABLE `event_api_destination`
+DROP INDEX `name_uniq_key`,
+ADD UNIQUE INDEX `name_uniq_key`(`name`, `account_id`) USING BTREE;
\ No newline at end of file
diff --git a/start/src/main/resources/application.properties b/start/src/main/resources/application.properties
index 3736814..62daed6 100644
--- a/start/src/main/resources/application.properties
+++ b/start/src/main/resources/application.properties
@@ -25,6 +25,7 @@ spring.profiles.active=local
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
## flyway
spring.flyway.placeholderReplacement=false
+spring.flyway.locations=classpath:db/h2-migration
## rocketmq
rocketmq.namesrvAddr=localhost:9876
rocketmq.connect.endpoint=http://127.0.0.1:8082
[rocketmq-eventbridge] 03/04: 1.add readme 2.modify ValidateFilter, add default filter
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
shenlin pushed a commit to branch runtimer
in repository https://gitbox.apache.org/repos/asf/rocketmq-eventbridge.git
commit 9d7b87e431392e2b28972d8f8613b4b6de8587b9
Author: wangkai <wa...@zhongan.com>
AuthorDate: Mon Jun 5 18:37:59 2023 +0800
1.add readme
2.modify ValidateFilter, add default filter
---
docs/cn/RocketMQEventBridgeDatabaseUsage.md | 29 ++++++++++++++
docs/cn/RocketMQEventBridgeRuleValidation.md | 44 +++++++++++++++++++++
docs/cn/images/h2.png | Bin 0 -> 188366 bytes
.../eventbridge/filter/ValidateFilter.java | 8 +++-
4 files changed, 80 insertions(+), 1 deletion(-)
diff --git a/docs/cn/RocketMQEventBridgeDatabaseUsage.md b/docs/cn/RocketMQEventBridgeDatabaseUsage.md
new file mode 100644
index 0000000..99e7bf8
--- /dev/null
+++ b/docs/cn/RocketMQEventBridgeDatabaseUsage.md
@@ -0,0 +1,29 @@
+## Apache RocketMQ EventBridge 数据库依赖介绍与使用
+
+RocketMQ EventBridge 使用数据库存储运行过程中定义的规则
+
+
+数据库:
+* 内置数据库h2,主要方便进行本地测试和快速开始
+* mysql数据库,实际生产部署时可以使用
+
+### 内置数据库
+```properties
+# 是否开启本地页面访问
+spring.profiles.active=local
+# h2 sql migration所在目录
+spring.flyway.locations=classpath:db/h2-migration
+```
+本地运行后,访问h2数据库。访问url: localhost:8083:
+
+
+### mysql数据库
+```properties
+## database
+spring.datasource.hikari.jdbc-url=jdbc:mysql://localhost:3306/eventBridge?useUnicode=true&characterEncoding=utf8&useSSL=false
+spring.datasource.hikari.driver-class-name=com.mysql.jdbc.Driver
+spring.datasource.hikari.username=xxxxx
+spring.datasource.hikari.password=xxxxx
+# 注释h2使用的sql migration
+#spring.flyway.locations=classpath:db/h2-migration
+```
\ No newline at end of file
diff --git a/docs/cn/RocketMQEventBridgeRuleValidation.md b/docs/cn/RocketMQEventBridgeRuleValidation.md
new file mode 100644
index 0000000..9f1f402
--- /dev/null
+++ b/docs/cn/RocketMQEventBridgeRuleValidation.md
@@ -0,0 +1,44 @@
+## Apache RocketMQ EventBridge 参数规则验证
+
+RocketMQ EventBridge 如何扩展参数验证
+
+
+### 引入依赖包
+```xml
+<dependency>
+ <groupId>org.apache.rocketmq</groupId>
+ <artifactId>rocketmq-eventbridge-infrastructure</artifactId>
+ <version>1.0.0</version>
+</dependency>
+```
+
+### 如何进行扩展
+```
+public class XXXXAuthValidation implements AuthValidation {
+
+ @Override
+ public Context validate(ServerHttpRequest request, Context ctx) {
+ ...
+ return ctx.put(keyxxx, valxxxx);
+ }
+
+ @Override
+ public String getType() {
+ return "验证器名称";
+ }
+}
+```
+
+### resources目录下增加spi配置
+```text
+/resources/
+|——META-INF
+| |——services
+| |——org.apache.rocketmq.eventbridge.infrastructure.validate.AuthValidation
+| org.apache.rocketmq.eventbridge.infrastructure.validate.XXXXAuthValidation
+```
+
+### 配置
+```properties
+auth.validation=验证器名称(如有多个以逗号分割)
+```
diff --git a/docs/cn/images/h2.png b/docs/cn/images/h2.png
new file mode 100644
index 0000000..109964e
Binary files /dev/null and b/docs/cn/images/h2.png differ
diff --git a/start/src/main/java/org/apache/rocketmq/eventbridge/filter/ValidateFilter.java b/start/src/main/java/org/apache/rocketmq/eventbridge/filter/ValidateFilter.java
index 5d80328..e6f81c2 100644
--- a/start/src/main/java/org/apache/rocketmq/eventbridge/filter/ValidateFilter.java
+++ b/start/src/main/java/org/apache/rocketmq/eventbridge/filter/ValidateFilter.java
@@ -34,6 +34,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
@Component
@Order(value = 3)
@@ -47,7 +48,12 @@ public class ValidateFilter implements WebFilter {
@PostConstruct
public void init() {
- Arrays.stream(validationName.split(",")).forEach(action->validations.add(ValidationServiceFactory.getInstance(action)));
+ List<String> validationNames = Arrays.stream(validationName.split(",")).collect(Collectors.toList());
+ boolean match = Arrays.stream(validationName.split(",")).allMatch(validationName-> validationName.equals("default"));
+ if (!match) {
+ validationNames.add(0, "default");
+ }
+ validationNames.forEach(action->validations.add(ValidationServiceFactory.getInstance(action)));
}
@Override