From 8eb7595b34e6f9df66f105bd920cefa74d7e1788 Mon Sep 17 00:00:00 2001 From: javahongxi Date: Thu, 17 Sep 2020 00:35:34 +0800 Subject: [PATCH] embed zk --- pom.xml | 27 +++++++++++++ whatsmars-elasticjob/pom.xml | 5 ++- .../org/hongxi/whatsmars/job/Application.java | 1 + whatsmars-zk-embed/pom.xml | 26 ++++++++++++ .../zk/embed}/EmbedZookeeperServer.java | 19 +-------- .../hongxi/whatsmars/zk/embed/Startup.java | 11 +++++ .../src/main/resources/logback.xml | 40 +++++++++++++++++++ 7 files changed, 109 insertions(+), 20 deletions(-) create mode 100644 whatsmars-zk-embed/pom.xml rename {whatsmars-elasticjob/src/main/java/org/hongxi/whatsmars/job => whatsmars-zk-embed/src/main/java/org/hongxi/whatsmars/zk/embed}/EmbedZookeeperServer.java (54%) create mode 100644 whatsmars-zk-embed/src/main/java/org/hongxi/whatsmars/zk/embed/Startup.java create mode 100644 whatsmars-zk-embed/src/main/resources/logback.xml diff --git a/pom.xml b/pom.xml index 09419873..328a370c 100644 --- a/pom.xml +++ b/pom.xml @@ -33,6 +33,7 @@ whatsmars-archetypes whatsmars-netty whatsmars-sentinel + whatsmars-zk-embed @@ -87,6 +88,32 @@ ${rocketmq.version} + + com.alibaba.csp + sentinel-core + ${sentinel.version} + + + com.alibaba.csp + sentinel-transport-simple-http + ${sentinel.version} + + + com.alibaba.csp + sentinel-spring-webmvc-adapter + ${sentinel.version} + + + com.alibaba.csp + sentinel-annotation-aspectj + ${sentinel.version} + + + com.alibaba.csp + sentinel-apache-dubbo-adapter + ${sentinel.version} + + com.google.guava guava diff --git a/whatsmars-elasticjob/pom.xml b/whatsmars-elasticjob/pom.xml index 182a355c..d75de9d9 100644 --- a/whatsmars-elasticjob/pom.xml +++ b/whatsmars-elasticjob/pom.xml @@ -34,8 +34,9 @@ - org.apache.curator - curator-test + org.hongxi + whatsmars-zk-embed + Rocket.S9 com.h2database diff --git a/whatsmars-elasticjob/src/main/java/org/hongxi/whatsmars/job/Application.java b/whatsmars-elasticjob/src/main/java/org/hongxi/whatsmars/job/Application.java index 08f13460..4308fb1a 100644 --- a/whatsmars-elasticjob/src/main/java/org/hongxi/whatsmars/job/Application.java +++ b/whatsmars-elasticjob/src/main/java/org/hongxi/whatsmars/job/Application.java @@ -17,6 +17,7 @@ package org.hongxi.whatsmars.job; +import org.hongxi.whatsmars.zk.embed.EmbedZookeeperServer; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/whatsmars-zk-embed/pom.xml b/whatsmars-zk-embed/pom.xml new file mode 100644 index 00000000..82bb5182 --- /dev/null +++ b/whatsmars-zk-embed/pom.xml @@ -0,0 +1,26 @@ + + + + whatsmars-parent + org.hongxi + Rocket.S9 + + 4.0.0 + + whatsmars-zk-embed + + + + org.apache.curator + curator-test + + + ch.qos.logback + logback-classic + true + + + + \ No newline at end of file diff --git a/whatsmars-elasticjob/src/main/java/org/hongxi/whatsmars/job/EmbedZookeeperServer.java b/whatsmars-zk-embed/src/main/java/org/hongxi/whatsmars/zk/embed/EmbedZookeeperServer.java similarity index 54% rename from whatsmars-elasticjob/src/main/java/org/hongxi/whatsmars/job/EmbedZookeeperServer.java rename to whatsmars-zk-embed/src/main/java/org/hongxi/whatsmars/zk/embed/EmbedZookeeperServer.java index f1d62358..614556f0 100644 --- a/whatsmars-elasticjob/src/main/java/org/hongxi/whatsmars/job/EmbedZookeeperServer.java +++ b/whatsmars-zk-embed/src/main/java/org/hongxi/whatsmars/zk/embed/EmbedZookeeperServer.java @@ -1,21 +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. - * 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.hongxi.whatsmars.job; +package org.hongxi.whatsmars.zk.embed; import org.apache.curator.test.TestingServer; diff --git a/whatsmars-zk-embed/src/main/java/org/hongxi/whatsmars/zk/embed/Startup.java b/whatsmars-zk-embed/src/main/java/org/hongxi/whatsmars/zk/embed/Startup.java new file mode 100644 index 00000000..395b3c21 --- /dev/null +++ b/whatsmars-zk-embed/src/main/java/org/hongxi/whatsmars/zk/embed/Startup.java @@ -0,0 +1,11 @@ +package org.hongxi.whatsmars.zk.embed; + +/** + * Created by shenhongxi on 2020/9/17. + */ +public class Startup { + + public static void main(String[] args) { + EmbedZookeeperServer.start(2181); + } +} diff --git a/whatsmars-zk-embed/src/main/resources/logback.xml b/whatsmars-zk-embed/src/main/resources/logback.xml new file mode 100644 index 00000000..aa948533 --- /dev/null +++ b/whatsmars-zk-embed/src/main/resources/logback.xml @@ -0,0 +1,40 @@ + + + + + + + + + + ${log.context.name} + + + + ${log.pattern} + + + + + + + + + + + -- GitLab