Skip to content

Commit

Permalink
Merge branch 'apache:main' into controller
Browse files Browse the repository at this point in the history
  • Loading branch information
zzxxiansheng committed Apr 18, 2024
2 parents a1ea37f + 6ca4640 commit 1f5f0ed
Show file tree
Hide file tree
Showing 16 changed files with 112 additions and 56 deletions.
10 changes: 7 additions & 3 deletions .asf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
#

github:
description: EventMesh Dashboard
description: Apache EventMesh Dashboard
features:
# Enable issue management
issues: true
# Enable wiki
wiki: true
homepage: https://eventmesh.apache.org/
homepage: https://eventmesh.apache.org
labels:
- pubsub
- event-mesh
Expand All @@ -40,7 +40,11 @@ github:
protected_branches:
main:
required_status_checks:
strict: true
strict: false
contexts:
- dependency-review
- Build (ubuntu-latest, 8, java)
- Build (ubuntu-latest, 11, java)
required_pull_request_reviews:
dismiss_stale_reviews: true
required_approving_review_count: 0 # Temporary 0 to allow committers to merge themselves PR
Expand Down
10 changes: 9 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ updates:
interval: "weekly"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
update-types: [ "version-update:semver-major" ]
- package-ecosystem: "npm"
directory: "./eventmesh-dashboard-view"
schedule:
interval: "monthly"
ignore:
- dependency-name: "*"
# Disable front-end PRs temporarily since 'npm run build' fails
update-types: [ "version-update:semver-major", "version-update:semver-minor", "version-update:semver-patch" ]
- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/auto-dependabot.yml
Original file line number Diff line number Diff line change
@@ -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.
#

name: Dependabot Auto-approve
on: pull_request_target

permissions:
contents: write
pull-requests: write

jobs:
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions
# Pull request Auto merge is not enabled for this repository
dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Approve PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# EventMesh Dashboard
# Apache EventMesh Dashboard

[🌐 简体中文](README.zh-CN.md)

Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# EventMesh Dashboard
# Apache EventMesh Dashboard

[🌐 English Version](README.md)

Expand Down
2 changes: 1 addition & 1 deletion eventmesh-dashboard-console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.2</version>
<version>3.2.5</version>
<configuration>
<excludes>
<exclude>**/org/apache/eventmesh/dashboard/console/integration/**/*.java</exclude>
Expand Down
23 changes: 1 addition & 22 deletions eventmesh-dashboard-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,6 @@
<version>0.7.7</version>
</dependency>

<!-- health check client -->
<!-- EventMesh SDK -->
<!-- <dependency>-->
<!-- <groupId>org.apache.eventmesh</groupId>-->
<!-- <artifactId>eventmesh-sdk-java</artifactId>-->
<!-- <version>1.10.0-release</version>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>junit</groupId>-->
<!-- <artifactId>junit</artifactId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <groupId>junit</groupId>-->
<!-- <artifactId>junit-dep</artifactId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <groupId>org.apache.logging.log4j</groupId>-->
<!-- <artifactId>log4j-slf4j-impl</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->
<!-- storage redis client -->
<dependency>
<groupId>io.lettuce</groupId>
Expand All @@ -116,7 +95,7 @@
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>4.9.4</version>
<version>4.9.8</version>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public class SDKManager {

private static volatile SDKManager INSTANCE = null;


public static synchronized SDKManager getInstance() {
if (INSTANCE == null) {
synchronized (SDKManager.class) {
Expand All @@ -62,60 +61,77 @@ public static synchronized SDKManager getInstance() {

/**
* inner key is the unique key of a client, such as (ip + port) they are defined in CreateClientConfig
*
* <p>
* key: SDKTypeEnum
* value: A map collection is used with key being (ip+port) and value being client.
* @see CreateSDKConfig#getUniqueKey()
*/
private static final Map<SDKTypeEnum, Map<String, Object>> clientMap = new ConcurrentHashMap<>();

private final Map<SDKTypeEnum, Map<String, Object>> clientMap = new ConcurrentHashMap<>();

private final Map<SDKTypeEnum, SDKOperation<?>> clientCreateOperationMap = new ConcurrentHashMap<>();
/**
* Initialise the SDKOperation object instance according to SDKTypeEnum.
* <p>
* key: SDKTypeEnum
* value: SDKOperation
* @see SDKTypeEnum
* @see SDKOperation
*/
private static final Map<SDKTypeEnum, SDKOperation<?>> clientCreateOperationMap = new ConcurrentHashMap<>();

// register all client create operation
{
static {
for (SDKTypeEnum clientTypeEnum : SDKTypeEnum.values()) {
clientMap.put(clientTypeEnum, new ConcurrentHashMap<>());
}

// redis
clientCreateOperationMap.put(SDKTypeEnum.STORAGE_REDIS, new RedisSDKOperation());

// rocketmq
clientCreateOperationMap.put(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, new RocketMQRemotingSDKOperation());
clientCreateOperationMap.put(SDKTypeEnum.STORAGE_ROCKETMQ_PRODUCER, new RocketMQProduceSDKOperation());
clientCreateOperationMap.put(SDKTypeEnum.STORAGE_ROCKETMQ_CONSUMER, new RocketMQPushConsumerSDKOperation());

// nacos
clientCreateOperationMap.put(SDKTypeEnum.META_NACOS, new NacosSDKOperation());
clientCreateOperationMap.put(SDKTypeEnum.META_NACOS_CONFIG, new NacosConfigSDKOperation());
clientCreateOperationMap.put(SDKTypeEnum.META_NACOS_NAMING, new NacosNamingSDKOperation());

// etcd
clientCreateOperationMap.put(SDKTypeEnum.META_ETCD, new EtcdSDKOperation());

// eventmesh_runtime
clientCreateOperationMap.put(SDKTypeEnum.RUNTIME_EVENTMESH_CLIENT, new RuntimeSDKOperation());

// eventmesh_runtime_tcp
clientCreateOperationMap.put(SDKTypeEnum.RUNTIME_TCP_CLOUDEVENT_CLIENT, new RuntimeTcpCloudEventSDKOperation());
clientCreateOperationMap.put(SDKTypeEnum.RUNTIME_TCP_EVENTMESH_CLIENT, new RuntimeTcpEventMeshSDKOperation());
clientCreateOperationMap.put(SDKTypeEnum.RUNTIME_TCP_OPENMESSAGE_CLIENT, new RuntimeTcpOpenMessageSDKOperation());

// eventmesh_runtime_http
clientCreateOperationMap.put(SDKTypeEnum.RUNTIME_HTTP_PRODUCER, new RuntimeHttpProducerSDKOperation());
clientCreateOperationMap.put(SDKTypeEnum.RUNTIME_HTTP_CONSUMER, new RuntimeHttpConsumerSDKOperation());

// eventmesh_runtime_grpc
clientCreateOperationMap.put(SDKTypeEnum.RUNTIME_GRPC_PRODUCER, new RuntimeGrpcProducerSDKOperation());
clientCreateOperationMap.put(SDKTypeEnum.RUNTIME_GRPC_CONSUMER, new RuntimeGrpcConsumerSDKOperation());
}

private SDKManager() {
}

/**
* Create SDK client through (SDKTypeEnum) clientTypeEnum, (CreateSDKConfig) config.
*/
public <T> SimpleEntry<String, T> createClient(SDKTypeEnum clientTypeEnum, CreateSDKConfig config) {
return createClient(clientTypeEnum, config.getUniqueKey(), config);
}

public <T> SimpleEntry<String, T> createClient(SDKTypeEnum clientTypeEnum, String uniqueKey, CreateSDKConfig config) {
final String uniqueKey = config.getUniqueKey();

Map<String, Object> clients = this.clientMap.get(clientTypeEnum);
Map<String, Object> clients = clientMap.get(clientTypeEnum);

Object client = clients.get(uniqueKey);
SimpleEntry<String, ?> result = new SimpleEntry<>(uniqueKey, client);
if (Objects.isNull(client)) {
SDKOperation<?> clientCreateOperation = this.clientCreateOperationMap.get(clientTypeEnum);
SDKOperation<?> clientCreateOperation = clientCreateOperationMap.get(clientTypeEnum);
result = clientCreateOperation.createClient(config);
clients.put(result.getKey(), result.getValue());
}
Expand All @@ -127,8 +143,8 @@ public <T> SimpleEntry<String, T> createClient(SDKTypeEnum clientTypeEnum, Strin
}

public void deleteClient(SDKTypeEnum clientTypeEnum, String uniqueKey) {
Map<String, Object> clients = this.clientMap.get(clientTypeEnum);
SDKOperation<?> operation = this.clientCreateOperationMap.get(clientTypeEnum);
Map<String, Object> clients = clientMap.get(clientTypeEnum);
SDKOperation<?> operation = clientCreateOperationMap.get(clientTypeEnum);
try {
operation.close(clients.get(uniqueKey));
} catch (Exception e) {
Expand All @@ -138,11 +154,11 @@ public void deleteClient(SDKTypeEnum clientTypeEnum, String uniqueKey) {
}

public Object getClient(SDKTypeEnum clientTypeEnum, String uniqueKey) {
return this.clientMap.get(clientTypeEnum).get(uniqueKey);
return clientMap.get(clientTypeEnum).get(uniqueKey);
}

// get all client
public Map<String, Object> getClients(SDKTypeEnum clientTypeEnum) {
return this.clientMap.get(clientTypeEnum);
return clientMap.get(clientTypeEnum);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
*/
public interface SDKOperation<T> {

public SimpleEntry<String, T> createClient(CreateSDKConfig clientConfig);
SimpleEntry<String, T> createClient(CreateSDKConfig clientConfig);


public void close(Object client);
void close(Object client);

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@

package org.apache.eventmesh.dashboard.core.function.SDK.config;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CreateNacosConfig implements CreateSDKConfig {

private String serverAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.Properties;

import com.alibaba.nacos.api.NacosFactory;
import com.alibaba.nacos.api.PropertyKeyConst;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.exception.NacosException;

Expand All @@ -39,7 +40,7 @@ public SimpleEntry<String, ConfigService> createClient(CreateSDKConfig clientCon
CreateNacosConfig config = (CreateNacosConfig) clientConfig;
try {
Properties properties = new Properties();
properties.put("serverAddr", config.getServerAddress());
properties.put(PropertyKeyConst.SERVER_ADDR, config.getServerAddress());
configService = NacosFactory.createConfigService(properties);
} catch (NacosException e) {
log.error("NacosCheck init failed caused by {}", e.getErrMsg());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.Properties;

import com.alibaba.nacos.api.NacosFactory;
import com.alibaba.nacos.api.PropertyKeyConst;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.api.naming.NamingService;
Expand All @@ -40,7 +41,7 @@ public SimpleEntry<String, NamingService> createClient(CreateSDKConfig clientCon
CreateNacosConfig config = (CreateNacosConfig) clientConfig;
try {
Properties properties = new Properties();
properties.put("serverAddr", config.getServerAddress());
properties.put(PropertyKeyConst.SERVER_ADDR, config.getServerAddress());
namingService = NacosFactory.createNamingService(properties);
} catch (NacosException e) {
log.error("NacosCheck init failed caused by {}", e.getErrMsg());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ void setUp() {
.password("")
.timeOut(30)
.build();
// createRedisConfig.setRedisUrl("redis://localhost:6379");
redisKey = SDKManager.getInstance().createClient(SDKTypeEnum.STORAGE_REDIS, createRedisConfig).getKey();
} catch (Exception e) {
log.warn("SDK manager test init failed, possible reason: redis-server is offline. {}", this.getClass().getSimpleName(), e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
public interface ConnectorRemotingService {

public GetConnectorResult getConnectors(GetConnectorRequest getConnectorRequest);
GetConnectorResult getConnectors(GetConnectorRequest getConnectorRequest);

public CreateConnectorResult createConnector(CreateConnectorRequest createConnectorRequest);
CreateConnectorResult createConnector(CreateConnectorRequest createConnectorRequest);
}
6 changes: 3 additions & 3 deletions eventmesh-dashboard-view/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot.version>2.7.6</spring-boot.version>
<spring-boot.version>2.7.18</spring-boot.version>
<mybatis-spring-boot.version>2.3.2</mybatis-spring-boot.version>
<nacos.version>2.3.2</nacos.version>
<rocketmq.version>4.9.8</rocketmq.version>
Expand Down

0 comments on commit 1f5f0ed

Please sign in to comment.