Skip to content

Commit

Permalink
Merge 1.3.0 to develop. (#430)
Browse files Browse the repository at this point in the history
* merge develop into 1.3.0 branch (#401)

* upgrade gradle to 6.8.3

* [ISSUE #265]rename wemq and access to eventmesh

* [ISSUE #265]rename proxy field to eventmesh

* merge conflict

* remove warn

* [ISSUE #265] Specification of code structure and file naming

* remove eventmesh-registry module

* enabled http/tcp monitor logs

* Update README.md

* Changed com.webank to org.apache

Changed 'eventmesh-connector-api' code package name to apache.

* issue #277:refactor eventmesh-common package with org.apache

* issue #277:rename package with org.apache

* Refactor 'eventmesh-connector-rocketmq' package name to org.apache

* Update README.zh-CN.md

* [ISSUE #282]Refactor 'eventmesh-starter' package name to org.apache

* Update codeStyle.xml

* Refactor 'eventmesh-test' package name to org.apache #283

* Refactor 'eventmesh-test' package name to org.apache #283

* Refactor 'eventmesh-test' package name to org.apache #283

* Refactor 'eventmesh-test' package name to org.apache #283

* Refactor 'eventmesh-test' package name to org.apache #283

* refactor runtime module package com.webank to org.apache

* refactor(eventmesh-sdk-java):rename to org.apache(#281)

* [ISSUE #281]refactor(eventmesh-sdk-java):rename to org.apache

* add licenses of apache for runtime module

* add NOTICE

* bugfix for event-mesh-test module

* change package name to org.apache

* format README.md

* change package name to org.apache

* fix ISSUE #296:add licenses in each source file under the eventmesh-sdk-java

* [ISSUE #294]add licenses in file under eventmesh-connector-rocketmq module

* [ISSUE #293]Lack of licenses in each source file under the eventmesh-connector-api module

* [ISSUE #298]Lack of licenses in each source file under the eventmesh-test module

* [ISSUE #297]Lack of licenses in each source file under the eventmesh-starter module

* Create .asf.yaml

* Update .asf.yaml

* Update .asf.yaml (#316)

* Update README.md

* Update .asf.yaml

* bugfix build.gradle tar task (#318)

Co-authored-by: jonyang(杨军) <jonyang@webank.com>

* [ISSUE #322] Rename package name "com.webank.eventmesh" to "org.apache.eventmesh" (#319)

* rename org.apache.runtime to com.webank.runtime

* rename com.webank.eventmesh to org.apache.eventmesh

* fix(docs): change the travis location

* Create DISCLAIMER-WIP

* Delete CNAME

* Delete _config.yml

* Delete package.json

* Add files via upload

* Add files via upload

* Delete eventmesh-multi-runtime.jpg

* Update README.md

* Update eventmesh-runtime-quickstart.md

* Update README.zh-CN.md

* Update eventmesh-runtime-quickstart.zh-CN.md

* [ISSUE #325]Update gradle configuration for publishing package to maven repository (#326)

* [ISSUE #325]Update gradle configuration for publishing package to maven repository

* update build.gradle

* update build.gradle and gradle.properties

* upgrade gradle to 7.0 and fix test bug. (#327)

* bugfix build.gradle tar task

* merge

* upgrade to gradle 7.0

* bugfix gradle task spotbugs

* bugfix eventmesh-connector-rocketmq testImplementation

* upgrade to gradle7.0

* refactor runtime module test and spotbugs error

* bugfix sign task

Co-authored-by: jonyang(杨军) <jonyang@webank.com>
Co-authored-by: jonyangx <jonyang1120@gmail.com>

* remove unused files

Signed-off-by: qqeasonchen <qqeasonchen@gmail.com>

* update build.gradle and gradle.properties for publish to maven repository (#330)

* [ISSUE #325]Update gradle configuration for publishing package to maven repository

* update build.gradle

* update build.gradle and gradle.properties

* update build.gradle and gradle.properties for publish to maven repository

* Update README.md

* Update README.zh-CN.md

* update quickstart md files for gradle version (#332)

* [ISSUE #325]Update gradle configuration for publishing package to maven repository

* update build.gradle

* update build.gradle and gradle.properties

* update build.gradle and gradle.properties for publish to maven repository

* * update gradle version for instructions
* fix: dist task exception

* remove dead docs

Signed-off-by: qqeasonchen <qqeasonchen@gmail.com>

* [ISSUE #329]Missing Log4j dependency (#336)

* [ISSUE #325]Update gradle configuration for publishing package to maven repository

* update build.gradle

* update build.gradle and gradle.properties

* update build.gradle and gradle.properties for publish to maven repository

* * update gradle version for instructions
* fix: dist task exception

* [ISSUE #329]Missing Log4j dependency

* [ISSUE #331] Fix dead links in docs (#334)

fixed #331

* Doc modification #328 (#335)

change vm params

* Update README.md

* [Issue #337] Fix Http Test Subscriber startup issue by moving the Thread.sleep into the child thread (#338)

* [Issue #337] Fix HttpSubscriber startup issue

* [Issue #337] test commit

* [Issue #337] revert test commit

Co-authored-by: j00441484 <jin.rong.luo@huawei.com>

* [Issue #337] Enhance Http Demo Subscriber by using ExecutorService, CountDownLatch and PreDestroy hook (#343)

* [Issue #337] Fix HttpSubscriber startup issue

* [Issue #337] test commit

* [Issue #337] revert test commit

* [Issue #337] Enhance Http Demo Subscriber by using ExecutorService, CountDownLatch and PreDestroy hook

* [Issue #337] Enhance Http Demo Subscriber by using ExecutorService, CountDownLatch and PreDestroy hook

* [Issue #337] Address code review comment for Subscriber Demo App

Co-authored-by: j00441484 <jin.rong.luo@huawei.com>

* [ISSUE #348] Setup automated workflows for greetings (#347)

* Setup automated workflows for greetings

* Remove '@apache/eventmesh-committers'

* Add LGTM Badges ISSUE#353 (#354)

LGTM is a variant analysis platform that automatically checks code for real CVEs and vulnerabilities. Learn more at https://lgtm.com/help/lgtm/about-lgtm .

Here are some alerts in our project reported by LGTM: https://lgtm.com/projects/g/apache/incubator-eventmesh/alerts/?mode=list

I'd like to add LGTM badges in the README.md, it makes easier for people who want to get alerts and then contribute to EventMesh.

* [ISSUE #355] Setup Github workflows for CodeQL scans (#356)

* Setup CodeQL scans

* disable autorun

* add a step for setting up JDK

* add codeql

* fix step Build

* fix strategy

* add events: schedule & workflow_dispatch

* [Issue #344] Fixing racing condition issue in SubscribeProcessor and UnSubscribeProcessor (#345)

* [Issue #337] Fix HttpSubscriber startup issue

* [Issue #337] test commit

* [Issue #337] revert test commit

* [Issue #337] Enhance Http Demo Subscriber by using ExecutorService, CountDownLatch and PreDestroy hook

* [Issue #337] Enhance Http Demo Subscriber by using ExecutorService, CountDownLatch and PreDestroy hook

* [Issue #344] Fixing racing condition issue in SubscribeProcessor and UnSubscribeProcessor

* [Issue #344] Fix import statements

* [Issue #337] Address code review comment for Subscriber Demo App

* [Issue #344] Enhance client registration logic in SubscribeProcessor and UnsubscriberProcessor

* [Issue #344] Minor code clean up in SubscribeProcessor and UnsubscriberProcessor

* [Issue #344] Fix NullPointerException in ConsumerManager occurs during subscribe/unsunscribe iteration testing

* [Issue #344] Fix bugs in subscribe/unsunscribe code path

* [Issue #344] use client.pid instead of client.ip for client comparasion in UnSubscribeProcessor

Co-authored-by: j00441484 <jin.rong.luo@huawei.com>

* update eventmesh-runtime.png (#358)

* update eventmesh-runtime.png

* [Issue #333] Support multiple load balance strategy in sdk (#342)

* Support multiple load balance strategy in sdk #333

* Fix ut

* add log

* update eventmesh-panels.png (#362)

* [ISSUE #325]Update gradle configuration for publishing package to maven repository

* update build.gradle

* update build.gradle and gradle.properties

* update build.gradle and gradle.properties for publish to maven repository

* * update gradle version for instructions
* fix: dist task exception

* [ISSUE #329]Missing Log4j dependency

* update eventmesh-runtime.png

* update eventmesh-panels.png

* update eventmesh-panels.png (#363)

* [ISSUE #325]Update gradle configuration for publishing package to maven repository

* update build.gradle

* update build.gradle and gradle.properties

* update build.gradle and gradle.properties for publish to maven repository

* * update gradle version for instructions
* fix: dist task exception

* [ISSUE #329]Missing Log4j dependency

* update eventmesh-runtime.png

* update eventmesh-panels.png

* Migrate CI to Github Actions and enable coverage report (#365)

* add: requirements for lightweight EventMesh SDK with CloudEvents (#370)

This commit only includes a brief introduction and requirements.
Design details can be followed up in a later commit.

Signed-off-by: Yuzhou Mao <myz@umich.edu>

* Add files via upload

* Update README.md

* [Issue #368] Fix Racing condition and memory leak issue in EventMesh SDK LiteConsumer and LiteProducer (#369)

* [Issue #337] Fix HttpSubscriber startup issue

* [Issue #337] test commit

* [Issue #337] revert test commit

* [Issue #337] Enhance Http Demo Subscriber by using ExecutorService, CountDownLatch and PreDestroy hook

* [Issue #337] Enhance Http Demo Subscriber by using ExecutorService, CountDownLatch and PreDestroy hook

* [Issue #337] Address code review comment for Subscriber Demo App

* [Issue #368] Fix Racing condition and memory leak issue in EventMesh SDK LiteConsumer and LiteProducer

* [Issue #368] fix build issue

* [Issue #368] use try with resource statement for HttpClient

* [Issue #368] fix TLS1.1 and use TLS1.2 in HttpClient

Co-authored-by: j00441484 <jin.rong.luo@huawei.com>

* [ISSUE #350]optimize flow control in downstreaming msg (#352)

* modify:optimize flow control in downstreaming msg

* modify:optimize stategy of selecting session in downstream msg

* modify:optimize msg downstream,msg store in session

* modify:fix bug:not a @sharable handler

* [ISSUE #380] Remove gitee-mirror.yml from Github workflows (#381)

* Update README.md

* [ISSUE #310] add github action for check license (#313)

* add github action for check license

* fix syntax and name ci for Check license

* fix github action branch typo

* [ISSUE #310] Enable Github Actions for license check and fix license headers (#377)

* add github action for check license

* fix syntax and name ci for Check license

* fix github action branch typo

* enable github actions for license check

* add necessary headers

* update badges

Co-authored-by: Lan Liang <gcslyp@gmail.com>

* [Issue #382] Fix java.lang.NumberFormatException when parsing Long (#383)

* [Issue #337] Fix HttpSubscriber startup issue

* [Issue #337] test commit

* [Issue #337] revert test commit

* [Issue #337] Enhance Http Demo Subscriber by using ExecutorService, CountDownLatch and PreDestroy hook

* [Issue #337] Enhance Http Demo Subscriber by using ExecutorService, CountDownLatch and PreDestroy hook

* [Issue #337] Address code review comment for Subscriber Demo App

* [Issue #368] Fix Racing condition and memory leak issue in EventMesh SDK LiteConsumer and LiteProducer

* [Issue #368] fix build issue

* [Issue #368] use try with resource statement for HttpClient

* [Issue #368] fix TLS1.1 and use TLS1.2 in HttpClient

* [Issue #382] Fix java.lang.NumberFormatException when parsing Long

* [Issue #382] Fix java.lang.NumberFormatException when parsing Integer

Co-authored-by: j00441484 <jin.rong.luo@huawei.com>

* [ISSUE #378] downstream broadcast msg asynchronously  (#379)

* modify:optimize flow control in downstreaming msg

* modify:optimize stategy of selecting session in downstream msg

* modify:optimize msg downstream,msg store in session

* modify:fix bug:not a @sharable handler

* modify:downstream broadcast msg asynchronously

closed #378

* [ISSUE #359] Split handler from controller (#359) (#360)

* [ISSUE #359] Split handler from controller (#359)

* add license header

* add ut

* [ISSUE #384] RedirectClientByIpPortHandlerTest.java doesn't have the Apache license header (#385)

close #384

* Update README.md

* Update README.zh-CN.md

* Update README.zh-CN.md

* Update README.zh-CN.md

* [Issue #386] fixing ConsumerGroup Queue Consumer Offset not synced up issue (#387)

* [Issue #337] Fix HttpSubscriber startup issue

* [Issue #337] test commit

* [Issue #337] revert test commit

* [Issue #337] Enhance Http Demo Subscriber by using ExecutorService, CountDownLatch and PreDestroy hook

* [Issue #337] Enhance Http Demo Subscriber by using ExecutorService, CountDownLatch and PreDestroy hook

* [Issue #337] Address code review comment for Subscriber Demo App

* [Issue #386] fixing ConsumerGroup Queuen Consumer Offset not synced up issue

* [Issue #386] adding license header to new file

* [Issue #386] Fix license header missing issue

Co-authored-by: j00441484 <jin.rong.luo@huawei.com>

* [ISSUE #366 ] remove custom-format topic concept (#388)

* remove custom-format topic concept

* remove custom-format topic concept

* remove custom-format topic concept

* remove custom-format topic concept

* remove custom-format topic concept

* remove custom-format topic concept

* remove custom-format topic concept

* [ISSUE #366] remove custom concept [dcn&&region] (#390)

* remove custom concept{dcn}

* remove custom concept{dcn}

* remove custom concept{dcn}

* remove custom concept{dcn}

* remove custom concept{dcn}

* remove custom concept{dcn}

* remove custom concept{dcn}

close #366

* [ISSUE #391] Optimize interface design in eventmesh-connector-api (#392)

* modify:optimize flow control in downstreaming msg

* modify:optimize stategy of selecting session in downstream msg

* modify:optimize msg downstream,msg store in session

* modify:fix bug:not a @sharable handler

* modify:downstream broadcast msg asynchronously

* modify:remove unneccessary interface in eventmesh-connector-api

* modify:fix conflict

* modify:add license in EventMeshAction
close #391

* miss group name set for userAgent (#395)

* remove custom concept{dcn}

* remove custom concept{dcn}

* remove custom concept{dcn}

* remove custom concept{dcn}

* remove custom concept{dcn}

* remove custom concept{dcn}

* remove custom concept{dcn}

* bugfix : miss group set

* bugfix : miss group set

* [ISSUE #393]:perf topic name in test file (#394)

close #393

* support unsubscribe topics while delconsumer in http mode (#396)

* [ISSUE #325]Update gradle configuration for publishing package to maven repository

* update build.gradle

* update build.gradle and gradle.properties

* update build.gradle and gradle.properties for publish to maven repository

* * update gradle version for instructions
* fix: dist task exception

* [ISSUE #329]Missing Log4j dependency

* update eventmesh-runtime.png

* support unsubscribe topics while delconsumer in http mode

* [ISSUE #397]Remove subscription session failed error (#398)

* [ISSUE #325]Update gradle configuration for publishing package to maven repository

* update build.gradle

* update build.gradle and gradle.properties

* update build.gradle and gradle.properties for publish to maven repository

* * update gradle version for instructions
* fix: dist task exception

* [ISSUE #329]Missing Log4j dependency

* update eventmesh-runtime.png

* support unsubscribe topics while delconsumer in http mode

* [ISSUE #397]Remove subscription session failed error

* [ISSUE #397]Remove subscription session failed error
close #397

Co-authored-by: jonyang(杨军) <jonyang@webank.com>
Co-authored-by: MajorHe1 <hefan1007@gmail.com>
Co-authored-by: mike_xwm <mike_xwm@126.com>
Co-authored-by: Eason Chen <qqeasonchen@gmail.com>
Co-authored-by: Heng Du <duhengforever@apache.org>
Co-authored-by: Udesh Liyanaarachchi <>
Co-authored-by: keranbingaa <397294722@qq.com>
Co-authored-by: sunxi <sunxi_mail@163.com>
Co-authored-by: sanchen <san@chenyiliu.com>
Co-authored-by: surilli(李慧敏) <surilli@webank.com>
Co-authored-by: Lan Liang <gcslyp@gmail.com>
Co-authored-by: zhangxiaopengmm <xiaopeng_521a@163.com>
Co-authored-by: nanoxiong <xiong_mengfei@163.com>
Co-authored-by: chenyi19851209 <409696597@qq.com>
Co-authored-by: yangjun <yangjun1120@gmail.com>
Co-authored-by: Steve Yurong Su <steveyurongsu@outlook.com>
Co-authored-by: von gosling <vongosling@apache.org>
Co-authored-by: jonyangx <jonyang1120@gmail.com>
Co-authored-by: ruanwenjun <861923274@qq.com>
Co-authored-by: jinrongluo <kapoking@gmail.com>
Co-authored-by: j00441484 <jin.rong.luo@huawei.com>
Co-authored-by: Yuzhou Mao <yuzhou.myz@gmail.com>
Co-authored-by: lrhkobe <34571087+lrhkobe@users.noreply.github.com>
Co-authored-by: Steve Yurong Su <rong@apache.org>
Co-authored-by: Lan <liangyuanpengem@163.com>

* [ISSUE #411] Enable CI workflows running on [0-9]+.[0-9]+.[0-9]+** branches (#413)

* [Issues #405]code polish and fix typo (#404)

* code polish and fix typo

* merge remote 1.3.0

* [ISSUE #374] Add unit test class. (#402)

* [ISSUE #374] add unit test for LiteMessage class.

* [ISSUE #374] add unit test for HttpCommand class.

* [ISSUE #374] add unit test for httpResponse method with REQ cmd type.

* [ISSUE-#374] Add unit test class. (#414)

* [ISSUE #374] add unit test for CommonConfiguration class.

* [ISSUE #374] add unit test for ConfigurationWraper class.

* [ISSUE #374] add unit test for Weight class.

* [ISSUE #374] add unit test for CommonConfiguration class.

* [ISSUE #367]Enhance SPI plugins (#419)

* [ISSUE #374] add unit test for http protocol header client class. (#420)

* fix typo (#423)

* [ISSUE #418]Refactor the plugin load code (#421)

* [ISSUE #418]Refactor the plugin load code

* fix ut

* [ISSUE #405]modify the doc (#424)

* modify the doc

* modify the doc

* Merege 1.3.0 to develop.

* Merege 1.3.0 to develop.

* Merge 1.3.0 to develop, fix check style problem.

Co-authored-by: wqliang <wqliang@users.noreply.github.com>
Co-authored-by: jonyang(杨军) <jonyang@webank.com>
Co-authored-by: MajorHe1 <hefan1007@gmail.com>
Co-authored-by: mike_xwm <mike_xwm@126.com>
Co-authored-by: Eason Chen <qqeasonchen@gmail.com>
Co-authored-by: Heng Du <duhengforever@apache.org>
Co-authored-by: keranbingaa <397294722@qq.com>
Co-authored-by: sunxi <sunxi_mail@163.com>
Co-authored-by: sanchen <san@chenyiliu.com>
Co-authored-by: surilli(李慧敏) <surilli@webank.com>
Co-authored-by: Lan Liang <gcslyp@gmail.com>
Co-authored-by: zhangxiaopengmm <xiaopeng_521a@163.com>
Co-authored-by: nanoxiong <xiong_mengfei@163.com>
Co-authored-by: chenyi19851209 <409696597@qq.com>
Co-authored-by: yangjun <yangjun1120@gmail.com>
Co-authored-by: Steve Yurong Su <steveyurongsu@outlook.com>
Co-authored-by: von gosling <vongosling@apache.org>
Co-authored-by: jonyangx <jonyang1120@gmail.com>
Co-authored-by: ruanwenjun <861923274@qq.com>
Co-authored-by: jinrongluo <kapoking@gmail.com>
Co-authored-by: j00441484 <jin.rong.luo@huawei.com>
Co-authored-by: Yuzhou Mao <yuzhou.myz@gmail.com>
Co-authored-by: lrhkobe <34571087+lrhkobe@users.noreply.github.com>
Co-authored-by: Steve Yurong Su <rong@apache.org>
Co-authored-by: Lan <liangyuanpengem@163.com>
Co-authored-by: YuDong Tang <583125614@qq.com>
  • Loading branch information
1 parent 4fdc4ac commit 4682cd3
Show file tree
Hide file tree
Showing 63 changed files with 1,397 additions and 194 deletions.
34 changes: 17 additions & 17 deletions docs/cn/instructions/eventmesh-runtime-quickstart.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ sh start.sh

### 2.1 依赖

同上述步骤 1.1
同上述步骤 1.1,但是只能在JDK 1.8下构建

### 2.2 下载源码

Expand All @@ -62,32 +62,32 @@ sh start.sh
- eventmesh-runtime : eventmesh运行时模块
- eventmesh-sdk-java : eventmesh java客户端sdk
- eventmesh-starter : eventmesh本地启动运行项目入口
- eventmesh-spi : eventmesh SPI加载模块

> 注:插件模块遵循java spi机制,需要在对应模块中的/main/resources/META-INF/services 下配置相关接口与实现类的映射文件
> 注:插件模块遵循eventmesh定义的spi机制,需要在对应模块中的/main/resources/META-INF/eventmesh 下配置相关接口与实现类的映射文件
**2.3.2 配置VM启动参数**
**2.3.2 配置插件**

```java
-Dlog4j.configurationFile=eventmesh-runtime/conf/log4j2.xml
-Deventmesh.log.home=eventmesh-runtime/logs
-Deventmesh.home=eventmesh-runtime
-DconfPath=eventmesh-runtime/conf
```
> 注:如果操作系统为Windows, 可能需要将文件分隔符换成\
`eventMesh.properties`配置文件通过声明式的方式来指定项目启动后需要加载的插件

**2.3.3 配置build.gradle文件**
修改`confPath`目录下面的`eventMesh.properties`文件

通过修改dependencies,compile project 项来指定项目启动后加载的插件
加载**RocketMQ Connector**插件配置:

修改`eventmesh-starter`模块下面的`build.gradle`文件
```java
#connector plugin
eventMesh.connector.plugin.type=rocketmq
```

加载**RocketMQ**插件配置:
**2.3.3 配置VM启动参数**

```java
dependencies {
compile project(":eventmesh-runtime"), project(":eventmesh-connector-rocketmq")
}
-Dlog4j.configurationFile=eventmesh-runtime/conf/log4j2.xml
-Deventmesh.log.home=eventmesh-runtime/logs
-Deventmesh.home=eventmesh-runtime
-DconfPath=eventmesh-runtime/conf
```
> 注:如果操作系统为Windows, 可能需要将文件分隔符换成\
**2.3.4 启动运行**

Expand Down
36 changes: 19 additions & 17 deletions docs/en/instructions/eventmesh-runtime-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ If you see "EventMeshTCPServer[port=10000] started....", you setup runtime succe

### 2.1 dependencies

Same with 1.1
Same with 1.1, but it can be only compiled in JDK 1.8

### 2.2 download sources

Expand All @@ -62,33 +62,35 @@ Same with 1.2
- eventmesh-runtime : eventmesh runtime module
- eventmesh-sdk-java : eventmesh java client sdk
- eventmesh-starter : eventmesh project local start entry
- eventmesh-spi : eventmesh SPI load module

> ps: The loading of connector plugin follows the Java SPI mechanism, it's necessary to configure the mapping file of
related interface and implementation class under /main/resources/meta-inf/services in the corresponding module
> ps: The loading of connector plugin follows the eventmesh SPI mechanism, it's necessary to configure the mapping file of
related interface and implementation class under /main/resources/meta-inf/eventmesh in the corresponding module

**2.3.2 Configure VM Options**
**2.3.2 Configure plugin**

```java
-Dlog4j.configurationFile=eventmesh-runtime/conf/log4j2.xml
-Deventmesh.log.home=eventmesh-runtime/logs
-Deventmesh.home=eventmesh-runtime
-DconfPath=eventmesh-runtime/conf
```
> ps: If you use Windows, you may need to replace the file separator to \

**2.3.3 Configure build.gradle file**
Specify the connector plugin that will be loaded after the project start by declaring in `eventMesh.properties`

Specify the connector that will be loaded after the project start with updating compile project item in dependencies

update `build.gradle` file under the `eventmesh-starter` module
Modify the `eventMesh.properties` file in the `confPath` directory

load **rocketmq connector** configuration:

```java
dependencies {
compile project(":eventmesh-runtime"), project(":eventmesh-connector-rocketmq")
}
#connector plugin
eventMesh.connector.plugin.type=rocketmq
```

**2.3.3 Configure VM Options**

```java
-Dlog4j.configurationFile=eventmesh-runtime/conf/log4j2.xml
-Deventmesh.log.home=eventmesh-runtime/logs
-Deventmesh.home=eventmesh-runtime
-DconfPath=eventmesh-runtime/conf
```
> ps: If you use Windows, you may need to replace the file separator to \
**2.3.4 Run**

Expand Down
Binary file modified docs/images/project-structure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion eventmesh-common/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
#
group=org.apache.eventmesh
version=1.2.0-SNAPSHOT
jdk=1.7
jdk=1.8
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static void randomSleep(int max) throws Exception {
/**
* get current process id only once.
*
* @return
* @return process id
*/
public static long getPID() {
if (currentPID >= 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,18 @@

package org.apache.eventmesh.common.config;

import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Enumeration;

import com.google.common.base.Preconditions;

import org.apache.commons.lang3.StringUtils;
import org.apache.eventmesh.common.IPUtil;

public class CommonConfiguration {
public String eventMeshEnv = "P";
public String eventMeshIDC = "FT";
public String eventMeshCluster = "LS";
public String eventMeshName = "";
public String sysID = "5477";

public String eventMeshConnectorPluginType = "rocketmq";

public String namesrvAddr = "";
public String clientUserName = "username";
Expand Down Expand Up @@ -84,8 +77,11 @@ public void init() {

eventMeshServerIp = configurationWraper.getProp(ConfKeys.KEYS_EVENTMESH_SERVER_HOST_IP);
if (StringUtils.isBlank(eventMeshServerIp)) {
eventMeshServerIp = getLocalAddr();
eventMeshServerIp = IPUtil.getLocalAddress();
}

eventMeshConnectorPluginType = configurationWraper.getProp(ConfKeys.KEYS_ENENTMESH_CONNECTOR_PLUGIN_TYPE);
Preconditions.checkState(StringUtils.isNotEmpty(eventMeshConnectorPluginType), String.format("%s error", ConfKeys.KEYS_ENENTMESH_CONNECTOR_PLUGIN_TYPE));
}
}

Expand All @@ -105,94 +101,7 @@ static class ConfKeys {
public static String KEYS_EVENTMESH_SERVER_REGISTER_INTERVAL = "eventMesh.server.registry.registerIntervalInMills";

public static String KEYS_EVENTMESH_SERVER_FETCH_REGISTRY_ADDR_INTERVAL = "eventMesh.server.registry.fetchRegistryAddrIntervalInMills";
}

public static String getLocalAddr() {
//priority of networkInterface when generating client ip
String priority = System.getProperty("networkInterface.priority", "bond1<eth1<eth0");
ArrayList<String> preferList = new ArrayList<String>();
for (String eth : priority.split("<")) {
preferList.add(eth);
}
NetworkInterface preferNetworkInterface = null;

try {
Enumeration<NetworkInterface> enumeration1 = NetworkInterface.getNetworkInterfaces();
while (enumeration1.hasMoreElements()) {
final NetworkInterface networkInterface = enumeration1.nextElement();
if (!preferList.contains(networkInterface.getName())) {
continue;
} else if (preferNetworkInterface == null) {
preferNetworkInterface = networkInterface;
}
//get the networkInterface that has higher priority
else if (preferList.indexOf(networkInterface.getName())
> preferList.indexOf(preferNetworkInterface.getName())) {
preferNetworkInterface = networkInterface;
}
}

// Traversal Network interface to get the first non-loopback and non-private address
ArrayList<String> ipv4Result = new ArrayList<String>();
ArrayList<String> ipv6Result = new ArrayList<String>();

if (preferNetworkInterface != null) {
final Enumeration<InetAddress> en = preferNetworkInterface.getInetAddresses();
getIpResult(ipv4Result, ipv6Result, en);
} else {
Enumeration<NetworkInterface> enumeration = NetworkInterface.getNetworkInterfaces();
while (enumeration.hasMoreElements()) {
final NetworkInterface networkInterface = enumeration.nextElement();
final Enumeration<InetAddress> en = networkInterface.getInetAddresses();
getIpResult(ipv4Result, ipv6Result, en);
}
}

// prefer ipv4
if (!ipv4Result.isEmpty()) {
for (String ip : ipv4Result) {
if (ip.startsWith("127.0") || ip.startsWith("192.168")) {
continue;
}

return ip;
}

return ipv4Result.get(ipv4Result.size() - 1);
} else if (!ipv6Result.isEmpty()) {
return ipv6Result.get(0);
}
//If failed to find,fall back to localhost
final InetAddress localHost = InetAddress.getLocalHost();
return normalizeHostAddress(localHost);
} catch (SocketException e) {
e.printStackTrace();
} catch (UnknownHostException e) {
e.printStackTrace();
}

return null;
}

public static String normalizeHostAddress(final InetAddress localHost) {
if (localHost instanceof Inet6Address) {
return "[" + localHost.getHostAddress() + "]";
} else {
return localHost.getHostAddress();
}
}

private static void getIpResult(ArrayList<String> ipv4Result, ArrayList<String> ipv6Result,
Enumeration<InetAddress> en) {
while (en.hasMoreElements()) {
final InetAddress address = en.nextElement();
if (!address.isLoopbackAddress()) {
if (address instanceof Inet6Address) {
ipv6Result.add(normalizeHostAddress(address));
} else {
ipv4Result.add(normalizeHostAddress(address));
}
}
}
public static String KEYS_ENENTMESH_CONNECTOR_PLUGIN_TYPE = "eventMesh.connector.plugin.type";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* This selector use random strategy.
* Each selection will randomly give one from the given list
*
* @param <T>
* @param <T> Target type
*/
public class RandomLoadBalanceSelector<T> implements LoadBalanceSelector<T> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* This selector use the weighted round robin strategy to select from list.
* If the weight is greater, the probability of being selected is larger.
*
* @param <T>
* @param <T> Target type
*/
public class WeightRoundRobinLoadBalanceSelector<T> implements LoadBalanceSelector<T> {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* 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.eventmesh.common;

import org.junit.Assert;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

public class LiteMessageTest {

@Test
public void testGetProp() {
LiteMessage message = createLiteMessage();
Assert.assertEquals(2L, message.getProp().size());
}

@Test
public void testSetProp() {
LiteMessage message = createLiteMessage();
Map<String, String> prop = new HashMap<>();
prop.put("key3", "value3");
message.setProp(prop);
Assert.assertEquals(1L, message.getProp().size());
Assert.assertEquals("value3", message.getPropKey("key3"));
}

@Test
public void testAddProp() {
LiteMessage message = createLiteMessage();
message.addProp("key3", "value3");
Assert.assertEquals(3L, message.getProp().size());
Assert.assertEquals("value1", message.getPropKey("key1"));
}

@Test
public void testGetPropKey() {
LiteMessage message = createLiteMessage();
Assert.assertEquals("value1", message.getPropKey("key1"));
}

@Test
public void testRemoveProp() {
LiteMessage message = createLiteMessage();
message.removeProp("key1");
Assert.assertEquals(1L, message.getProp().size());
Assert.assertNull(message.getPropKey("key1"));
}

private LiteMessage createLiteMessage() {
LiteMessage result = new LiteMessage();
Map<String, String> prop = new HashMap<>();
prop.put("key1", "value1");
prop.put("key2", "value2");
result.setProp(prop);
return result;
}
}
Loading

0 comments on commit 4682cd3

Please sign in to comment.