This is an automated email from the ASF dual-hosted git repository.

shenlin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/rocketmq-eventbridge.git

commit 7c369bf3d6d222c047812dba339969ff07b02cc9
Author: 2011shenlin <[email protected]>
AuthorDate: Mon Sep 26 01:24:52 2022 +0800

    prepare to release 1.0.0
---
 bin/eventbridge.sh | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 bin/runserver.sh   | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 start/pom.xml      | 41 ++++++++++++++++++++++++
 3 files changed, 227 insertions(+)

diff --git a/bin/eventbridge.sh b/bin/eventbridge.sh
new file mode 100755
index 0000000..3ace2ed
--- /dev/null
+++ b/bin/eventbridge.sh
@@ -0,0 +1,93 @@
+#!/bin/sh
+
+#
+# /*
+#  * 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.
+#  */
+#
+
+if [ -z "$ROCKETMQ_EVENTBRIDGE_HOME" ]; then
+  ## resolve links - $0 may be a link to maven's home
+  PRG="$0"
+
+  # need this for relative symlinks
+  while [ -h "$PRG" ]; do
+    ls=$(ls -ld "$PRG")
+    link=$(expr "$ls" : '.*-> \(.*\)$')
+    if expr "$link" : '/.*' >/dev/null; then
+      PRG="$link"
+    else
+      PRG="$(dirname "$PRG")/$link"
+    fi
+  done
+
+  saveddir=$(pwd)
+
+  ROCKETMQ_EVENTBRIDGE_HOME=$(dirname "$PRG")
+
+  # make it fully qualified
+  ROCKETMQ_EVENTBRIDGE_HOME=$(cd "$ROCKETMQ_EVENTBRIDGE_HOME" && pwd)
+
+  cd "$saveddir"
+fi
+
+export ROCKETMQ_EVENTBRIDGE_HOME
+
+BASEDIR=$HOME
+mkdir -p $BASEDIR/logs
+
+mainClass="org.apache.rocketmq.eventbridge.Main"
+
+function startup() {
+  pid=`ps aux|grep $mainClass|grep -v grep |awk '{print $2}'`
+  if [ ! -z "$pid" ]; then
+    echo "java is runing..."
+    exit 1
+  fi
+  nohup ${ROCKETMQ_EVENTBRIDGE_HOME}/runserver.sh -jar 
rocketmq-eventbridge.jar $@ >$BASEDIR/logs/rocketmq-eventbridge.log 2>&1 &
+}
+
+function stop() {
+  pid=`ps aux|grep $mainClass|grep -v grep |awk '{print $2}'`
+  if [ -z "$pid" ]; then
+    echo "no java to kill"
+  fi
+  printf 'stop...'
+  kill $pid
+  sleep 3
+  pid=`ps aux|grep $mainClass|grep -v grep |awk '{print $2}'`
+
+  if [ ! -z $pid ]; then
+    kill -9 $pid
+  fi
+}
+
+case "$1" in
+start)
+  startup $@
+  ;;
+stop)
+  stop
+  ;;
+restart)
+  stop
+  startup
+  ;;
+*)
+  printf "Usage: sh  $0 %s {start|stop|restart}\n"
+  exit 1
+  ;;
+esac
diff --git a/bin/runserver.sh b/bin/runserver.sh
new file mode 100755
index 0000000..de9541c
--- /dev/null
+++ b/bin/runserver.sh
@@ -0,0 +1,93 @@
+#!/bin/sh
+
+# 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.
+
+#===========================================================================================
+# Java Environment Setting
+#===========================================================================================
+error_exit ()
+{
+    echo "ERROR: $1 !!"
+    exit 1
+}
+
+[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java
+[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java
+[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME 
variable in your environment, We need java(x64)!"
+
+export JAVA_HOME
+export JAVA="$JAVA_HOME/bin/java"
+export BASE_DIR=$(dirname $0)/..
+export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH}
+
+#===========================================================================================
+# JVM Configuration
+#===========================================================================================
+# The RAMDisk initializing size in MB on Darwin OS for gc-log
+DIR_SIZE_IN_MB=600
+
+choose_gc_log_directory()
+{
+    case "`uname`" in
+        Darwin)
+            if [ ! -d "/Volumes/RAMDisk" ]; then
+                # create ram disk on Darwin systems as gc-log directory
+                DEV=`hdiutil attach -nomount ram://$((2 * 1024 * 
DIR_SIZE_IN_MB))` > /dev/null
+                diskutil eraseVolume HFS+ RAMDisk ${DEV} > /dev/null
+                echo "Create RAMDisk /Volumes/RAMDisk for gc logging on Darwin 
OS."
+            fi
+            GC_LOG_DIR="/Volumes/RAMDisk"
+        ;;
+        *)
+            # check if /dev/shm exists on other systems
+            if [ -d "/dev/shm" ]; then
+                GC_LOG_DIR="/dev/shm"
+            else
+                GC_LOG_DIR=${BASE_DIR}
+            fi
+        ;;
+    esac
+}
+
+choose_gc_options()
+{
+    # Example of JAVA_MAJOR_VERSION value : '1', '9', '10', '11', ...
+    # '1' means releases befor Java 9
+    JAVA_MAJOR_VERSION=$("$JAVA" -version 2>&1 | sed -r -n 's/.* version 
"([0-9]*).*$/\1/p')
+    if [ -z "$JAVA_MAJOR_VERSION" ] || [ "$JAVA_MAJOR_VERSION" -lt "9" ] ; then
+      JAVA_OPT="${JAVA_OPT} -server -Xms4g -Xmx4g -Xmn2g 
-XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
+      JAVA_OPT="${JAVA_OPT} -XX:+UseConcMarkSweepGC 
-XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 
-XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 
-XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:-UseParNewGC"
+      JAVA_OPT="${JAVA_OPT} -verbose:gc 
-Xloggc:${GC_LOG_DIR}/rmq_srv_gc_%p_%t.log -XX:+PrintGCDetails 
-XX:+PrintGCDateStamps"
+      JAVA_OPT="${JAVA_OPT} -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 
-XX:GCLogFileSize=30m"
+    else
+      JAVA_OPT="${JAVA_OPT} -server -Xms4g -Xmx4g -XX:MetaspaceSize=128m 
-XX:MaxMetaspaceSize=320m"
+      JAVA_OPT="${JAVA_OPT} -XX:+UseG1GC -XX:G1HeapRegionSize=16m 
-XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 
-XX:SoftRefLRUPolicyMSPerMB=0"
+      JAVA_OPT="${JAVA_OPT} 
-Xlog:gc*:file=${GC_LOG_DIR}/rmq_srv_gc_%p_%t.log:time,tags:filecount=5,filesize=30M"
+    fi
+}
+
+choose_gc_log_directory
+choose_gc_options
+JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow"
+JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages"
+JAVA_OPT="${JAVA_OPT} 
-Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${BASE_DIR}/lib:${JAVA_HOME}/lib/ext"
+#JAVA_OPT="${JAVA_OPT} -Xdebug 
-Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n"
+JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}"
+JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}"
+
+JAVA_OPT="${JAVA_OPT} -Dlogback.configurationFile=${BASE_DIR}/conf/logback.xml"
+
+$JAVA ${JAVA_OPT} $@
\ No newline at end of file
diff --git a/start/pom.xml b/start/pom.xml
index bdae820..282cbf7 100644
--- a/start/pom.xml
+++ b/start/pom.xml
@@ -70,4 +70,45 @@
         </dependency>
     </dependencies>
 
+    <build>
+        <finalName>rocketmq-eventbridge</finalName>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>logback.xml</include>
+                    <include>application.properties</include>
+                    <include>**/*.xml</include>
+                </includes>
+            </resource>
+            <resource>
+                <directory>src/main/java</directory>
+                <includes>
+                    <include>**/*.properties</include>
+                    <include>**/*.xml</include>
+                    <include>**/*.tld</include>
+                </includes>
+                <filtering>false</filtering>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.2.10.RELEASE</version>
+                <executions>
+                    <execution>
+                        <id>repackage</id>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                        <configuration>
+                            
<mainClass>org.apache.rocketmq.eventbridge.Main</mainClass>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
 </project>
\ No newline at end of file

Reply via email to