This is an automated email from the ASF dual-hosted git repository. aloyszhang pushed a commit to branch dev-offline-sync in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/dev-offline-sync by this push: new 08c520d5e4 [INLONG-10395][Manager] Add interface for schedule client and engine (#10397) 08c520d5e4 is described below commit 08c520d5e41b2f94ad450e7f35967e8c48169371 Author: AloysZhang <aloyszh...@apache.org> AuthorDate: Thu Jun 13 15:02:14 2024 +0800 [INLONG-10395][Manager] Add interface for schedule client and engine (#10397) * [INLONG-10395][Manager] Add interface for schedule client and engine --- inlong-manager/manager-schedule/pom.xml | 41 ++++++++++++++++ .../org/apache/inlong/schedule/ScheduleEngine.java | 54 ++++++++++++++++++++++ .../inlong/schedule/ScheduleEngineClient.java | 45 ++++++++++++++++++ inlong-manager/pom.xml | 1 + 4 files changed, 141 insertions(+) diff --git a/inlong-manager/manager-schedule/pom.xml b/inlong-manager/manager-schedule/pom.xml new file mode 100644 index 0000000000..f3a4e0a41f --- /dev/null +++ b/inlong-manager/manager-schedule/pom.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.inlong</groupId> + <artifactId>inlong-manager</artifactId> + <version>1.13.0-SNAPSHOT</version> + </parent> + + <artifactId>manager-schedule</artifactId> + + <properties> + <inlong.root.dir>${project.parent.parent.basedir}</inlong.root.dir> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.inlong</groupId> + <artifactId>manager-pojo</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> +</project> diff --git a/inlong-manager/manager-schedule/src/main/java/org/apache/inlong/schedule/ScheduleEngine.java b/inlong-manager/manager-schedule/src/main/java/org/apache/inlong/schedule/ScheduleEngine.java new file mode 100644 index 0000000000..bfdb9a88ad --- /dev/null +++ b/inlong-manager/manager-schedule/src/main/java/org/apache/inlong/schedule/ScheduleEngine.java @@ -0,0 +1,54 @@ +/* + * 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.inlong.schedule; + +import org.apache.inlong.manager.pojo.schedule.ScheduleInfo; + +/** + * Build-in schedule engine, provides basic schedule capabilities. + * */ +public interface ScheduleEngine { + + /** + * Start schedule engine. + * */ + void start(); + + /** + * Handle schedule register. + * @param scheduleInfo schedule info to register + * */ + boolean handleRegister(ScheduleInfo scheduleInfo); + + /** + * Handle schedule unregister. + * @param scheduleInfo schedule info to unregister + * */ + boolean handleUnregister(ScheduleInfo scheduleInfo); + + /** + * Handle schedule update. + * @param scheduleInfo schedule info to update + * */ + boolean handleUpdate(ScheduleInfo scheduleInfo); + + /** + * Stop schedule engine. + * */ + void stop(); +} diff --git a/inlong-manager/manager-schedule/src/main/java/org/apache/inlong/schedule/ScheduleEngineClient.java b/inlong-manager/manager-schedule/src/main/java/org/apache/inlong/schedule/ScheduleEngineClient.java new file mode 100644 index 0000000000..1e5ce3460c --- /dev/null +++ b/inlong-manager/manager-schedule/src/main/java/org/apache/inlong/schedule/ScheduleEngineClient.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.inlong.schedule; + +import org.apache.inlong.manager.pojo.schedule.ScheduleInfo; + +/** + * Interface for schedule engine client which responses for communicating with schedule engine. + * */ +public interface ScheduleEngineClient { + + /** + * Register schedule to schedule engine. + * @param scheduleInfo schedule info to register + * */ + boolean register(ScheduleInfo scheduleInfo); + + /** + * Un-register schedule from schedule engine. + * @param scheduleInfo schedule info to unregister + * */ + boolean unregister(ScheduleInfo scheduleInfo); + + /** + * Update schedule from schedule engine. + * @param scheduleInfo schedule info to update + * */ + boolean update(ScheduleInfo scheduleInfo); + +} diff --git a/inlong-manager/pom.xml b/inlong-manager/pom.xml index 24288c21c3..bff220728b 100644 --- a/inlong-manager/pom.xml +++ b/inlong-manager/pom.xml @@ -41,6 +41,7 @@ <module>manager-workflow</module> <module>manager-web</module> <module>manager-docker</module> + <module>manager-schedule</module> </modules> <properties>