forked from apache/eventmesh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'eventmesh-function' of https://github.com/apache/eventmesh
- Loading branch information
Showing
30 changed files
with
787 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea/modules.xml | ||
.idea/jarRepositories.xml | ||
.idea/compiler.xml | ||
.idea/libraries/ | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
dependencies { | ||
implementation project(":eventmesh-spi") | ||
implementation project(":eventmesh-common") | ||
implementation "com.alibaba.nacos:nacos-client" | ||
implementation ("org.springframework.boot:spring-boot-starter-web") { | ||
exclude group: "org.springframework.boot" ,module: "spring-boot-starter-tomcat" | ||
} | ||
implementation 'org.springframework.boot:spring-boot-starter-jetty' | ||
|
||
implementation "org.mybatis.spring.boot:mybatis-spring-boot-starter" | ||
// https://mvnrepository.com/artifact/com.alibaba/druid-spring-boot-starter | ||
implementation "com.alibaba:druid-spring-boot-starter" | ||
compileOnly 'org.projectlombok:lombok' | ||
annotationProcessor 'org.projectlombok:lombok' | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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. | ||
# |
24 changes: 24 additions & 0 deletions
24
eventmesh-admin-server/src/main/java/com/apache/eventmesh/admin/server/Admin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.apache.eventmesh.admin.server; | ||
|
||
import org.apache.eventmesh.common.utils.PagedList; | ||
|
||
import com.apache.eventmesh.admin.server.task.Task; | ||
|
||
public interface Admin extends ComponentLifeCycle{ | ||
/** | ||
* support for web or ops | ||
**/ | ||
boolean createOrUpdateTask(Task task); | ||
boolean deleteTask(Long id); | ||
Task getTask(Long id); | ||
// paged list | ||
PagedList<Task> getTaskPaged(Task task); | ||
|
||
/** | ||
* support for task | ||
*/ | ||
void reportHeartbeat(HeartBeat heartBeat); | ||
|
||
|
||
|
||
} |
11 changes: 11 additions & 0 deletions
11
eventmesh-admin-server/src/main/java/com/apache/eventmesh/admin/server/AdminException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.apache.eventmesh.admin.server; | ||
|
||
public class AdminException extends RuntimeException { | ||
public AdminException(String message) { | ||
super(message); | ||
} | ||
|
||
public AdminException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
eventmesh-admin-server/src/main/java/com/apache/eventmesh/admin/server/AdminServer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.apache.eventmesh.admin.server; | ||
|
||
import com.apache.eventmesh.admin.server.registry.EventMeshAdminServerRegisterInfo; | ||
import com.apache.eventmesh.admin.server.registry.RegistryService; | ||
import org.apache.eventmesh.common.utils.PagedList; | ||
|
||
import com.apache.eventmesh.admin.server.task.Task; | ||
|
||
public class AdminServer implements Admin { | ||
|
||
private RegistryService registryService; | ||
|
||
private EventMeshAdminServerRegisterInfo registerInfo; | ||
|
||
public AdminServer(RegistryService registryService, EventMeshAdminServerRegisterInfo registerInfo) { | ||
this.registryService = registryService; | ||
this.registerInfo = registerInfo; | ||
} | ||
|
||
public static final String ConfigurationKey = "admin-server"; | ||
@Override | ||
public boolean createOrUpdateTask(Task task) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean deleteTask(Long id) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public Task getTask(Long id) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public PagedList<Task> getTaskPaged(Task task) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void reportHeartbeat(HeartBeat heartBeat) { | ||
|
||
} | ||
|
||
@Override | ||
public void start() { | ||
|
||
registryService.register(registerInfo); | ||
} | ||
|
||
@Override | ||
public void destroy() { | ||
registryService.unRegister(registerInfo); | ||
registryService.shutdown(); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...mesh-admin-server/src/main/java/com/apache/eventmesh/admin/server/ComponentLifeCycle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.apache.eventmesh.admin.server; | ||
|
||
public interface ComponentLifeCycle { | ||
void start(); | ||
void destroy(); | ||
} |
12 changes: 12 additions & 0 deletions
12
eventmesh-admin-server/src/main/java/com/apache/eventmesh/admin/server/HeartBeat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.apache.eventmesh.admin.server; | ||
|
||
import com.apache.eventmesh.admin.server.task.JobState; | ||
import com.apache.eventmesh.admin.server.task.Position; | ||
|
||
public class HeartBeat { | ||
private String address; | ||
private String reportedTimeStamp; | ||
private String jobID; | ||
private Position position; | ||
private JobState state; | ||
} |
14 changes: 14 additions & 0 deletions
14
...er/src/main/java/com/apache/eventmesh/admin/server/registry/AbstractRegistryListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.apache.eventmesh.admin.server.registry; | ||
|
||
public abstract class AbstractRegistryListener<T> implements RegistryListener { | ||
protected abstract boolean checkType(Object data); | ||
@Override | ||
@SuppressWarnings("unchecked") | ||
public void onChange(Object data) { | ||
if (!checkType(data)) { | ||
return; | ||
} | ||
process((T)data); | ||
} | ||
protected abstract void process(T data); | ||
} |
32 changes: 32 additions & 0 deletions
32
...in/java/com/apache/eventmesh/admin/server/registry/EventMeshAdminServerConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.apache.eventmesh.admin.server.registry; | ||
|
||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.NoArgsConstructor; | ||
import org.apache.eventmesh.common.config.CommonConfiguration; | ||
import org.apache.eventmesh.common.config.Config; | ||
import org.apache.eventmesh.common.config.ConfigFiled; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@EqualsAndHashCode(callSuper = true) | ||
@Config(prefix = "eventMesh.admin") | ||
public class EventMeshAdminServerConfiguration extends CommonConfiguration { | ||
@ConfigFiled(field = "server.http.port") | ||
private int eventMeshHttpServerPort = 10000; | ||
|
||
@ConfigFiled(field = "server.gRPC.port") | ||
private int eventMeshGrpcServerPort = 10000; | ||
|
||
@ConfigFiled(field = "registry.plugin.server-addr", notEmpty = true) | ||
private String registryCenterAddr = ""; | ||
|
||
@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 = ""; | ||
} |
14 changes: 14 additions & 0 deletions
14
...ain/java/com/apache/eventmesh/admin/server/registry/EventMeshAdminServerRegisterInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.apache.eventmesh.admin.server.registry; | ||
|
||
import lombok.Data; | ||
|
||
import java.util.Map; | ||
|
||
@Data | ||
public class EventMeshAdminServerRegisterInfo { | ||
private String eventMeshClusterName; | ||
private String eventMeshName; | ||
private String address; | ||
|
||
private Map<String, String> metadata; | ||
} |
Oops, something went wrong.