Skip to content

Commit

Permalink
Eventmesh function admin (#4854)
Browse files Browse the repository at this point in the history
* own

* dependency

* finish registry

* init

* 0419

* 0419

* more discovery and move gRPC

* fix dependency
  • Loading branch information
sodaRyCN authored Apr 22, 2024
1 parent 02bcd35 commit 02f6d44
Show file tree
Hide file tree
Showing 28 changed files with 2,608 additions and 94 deletions.
2 changes: 2 additions & 0 deletions eventmesh-admin-server/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
dependencies {
implementation project(":eventmesh-spi")
implementation project(":eventmesh-common")
implementation project(":eventmesh-registry:eventmesh-registry-api")
implementation project(":eventmesh-registry:eventmesh-registry-nacos")
implementation "com.alibaba.nacos:nacos-client"
implementation ("org.springframework.boot:spring-boot-starter-web") {
exclude group: "org.springframework.boot", module: "spring-boot-starter-tomcat"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
package com.apache.eventmesh.admin.server;

import com.apache.eventmesh.admin.server.registry.EventMeshAdminServerRegisterInfo;
import com.apache.eventmesh.admin.server.registry.RegistryService;
import com.apache.eventmesh.admin.server.task.Task;
import org.apache.eventmesh.common.utils.PagedList;
import org.apache.eventmesh.registry.RegistryService;

public class AdminServer implements Admin {

private RegistryService registryService;

private EventMeshAdminServerRegisterInfo registerInfo;
// private EventMeshAdminServerRegisterInfo registerInfo;

public AdminServer(RegistryService registryService, EventMeshAdminServerRegisterInfo registerInfo) {
public AdminServer(RegistryService registryService) {
this.registryService = registryService;
this.registerInfo = registerInfo;
// this.registerInfo = registerInfo;
}

public static final String ConfigurationKey = "admin-server";

@Override
public boolean createOrUpdateTask(Task task) {
return false;
Expand Down Expand Up @@ -44,13 +43,12 @@ public void reportHeartbeat(HeartBeat heartBeat) {

@Override
public void start() {

registryService.register(registerInfo);
registryService.register(null);
}

@Override
public void destroy() {
registryService.unRegister(registerInfo);
registryService.unRegister(null);
registryService.shutdown();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.apache.eventmesh.admin.server.registry;
package com.apache.eventmesh.admin.server;

import lombok.Data;
import lombok.EqualsAndHashCode;
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.apache.eventmesh.admin.server.web;

import com.apache.eventmesh.admin.server.ComponentLifeCycle;
import com.apache.eventmesh.admin.server.web.generated.AdminBiStreamServiceGrpc;
import org.apache.eventmesh.common.protocol.grpc.adminserver.AdminBiStreamServiceGrpc;
import org.springframework.stereotype.Controller;

@Controller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,17 @@

package org.apache.eventmesh.common.config;

import static org.apache.eventmesh.common.Constants.HTTP;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.utils.IPUtils;

import org.apache.commons.collections4.CollectionUtils;
import org.assertj.core.util.Strings;

import java.util.Collections;
import java.util.List;

import org.assertj.core.util.Strings;

import lombok.Data;
import lombok.NoArgsConstructor;
import static org.apache.eventmesh.common.Constants.HTTP;

@Data
@NoArgsConstructor
Expand Down Expand Up @@ -115,6 +112,18 @@ public class CommonConfiguration {
@ConfigFiled(field = "server.retry.plugin.type")
private String eventMeshRetryPluginType = Constants.DEFAULT;

@ConfigFiled(field = "registry.plugin.server-addr", notEmpty = true)
private String registryAddr = "";

@ConfigFiled(field = "registry.plugin.type", notEmpty = true)
private String eventMeshRegistryPluginType = "nacos";

@ConfigFiled(field = "registry.plugin.username")
private String eventMeshRegistryPluginUsername = "";

@ConfigFiled(field = "registry.plugin.password")
private String eventMeshRegistryPluginPassword = "";

public void reload() {
this.eventMeshWebhookOrigin = "eventmesh." + eventMeshIDC;

Expand Down
Loading

0 comments on commit 02f6d44

Please sign in to comment.