Skip to content

Commit

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

* upgrade gradle to 6.8.3

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

* [ISSUE apache#265]rename proxy field to eventmesh

* merge conflict

* remove warn

* [ISSUE apache#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 apache#277:refactor eventmesh-common package with org.apache

* issue apache#277:rename package with org.apache

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

* Update README.zh-CN.md

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

* Update codeStyle.xml

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

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

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

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

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

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

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

* [ISSUE apache#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 apache#296:add licenses in each source file under the eventmesh-sdk-java

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

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

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

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

* Create .asf.yaml

* Update .asf.yaml

* Update .asf.yaml (apache#316)

* Update README.md

* Update .asf.yaml

* bugfix build.gradle tar task (apache#318)

Co-authored-by: jonyang(杨军) <[email protected]>

* [ISSUE apache#322] Rename package name "com.webank.eventmesh" to "org.apache.eventmesh" (apache#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 apache#325]Update gradle configuration for publishing package to maven repository (apache#326)

* [ISSUE apache#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. (apache#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(杨军) <[email protected]>
Co-authored-by: jonyangx <[email protected]>

* remove unused files

Signed-off-by: qqeasonchen <[email protected]>

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

* [ISSUE apache#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 (apache#332)

* [ISSUE apache#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 <[email protected]>

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

* [ISSUE apache#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 apache#329]Missing Log4j dependency

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

fixed apache#331

* Doc modification apache#328 (apache#335)

change vm params

* Update README.md

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

* [Issue apache#337] Fix HttpSubscriber startup issue

* [Issue apache#337] test commit

* [Issue apache#337] revert test commit

Co-authored-by: j00441484 <[email protected]>

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

* [Issue apache#337] Fix HttpSubscriber startup issue

* [Issue apache#337] test commit

* [Issue apache#337] revert test commit

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

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

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

Co-authored-by: j00441484 <[email protected]>

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

* Setup automated workflows for greetings

* Remove '@apache/eventmesh-committers'

* Add LGTM Badges ISSUE#353 (apache#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 apache#355] Setup Github workflows for CodeQL scans (apache#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 apache#344] Fixing racing condition issue in SubscribeProcessor and UnSubscribeProcessor (apache#345)

* [Issue apache#337] Fix HttpSubscriber startup issue

* [Issue apache#337] test commit

* [Issue apache#337] revert test commit

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

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

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

* [Issue apache#344] Fix import statements

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

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

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

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

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

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

Co-authored-by: j00441484 <[email protected]>

* update eventmesh-runtime.png (apache#358)

* update eventmesh-runtime.png

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

* Support multiple load balance strategy in sdk apache#333

* Fix ut

* add log

* update eventmesh-panels.png (apache#362)

* [ISSUE apache#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 apache#329]Missing Log4j dependency

* update eventmesh-runtime.png

* update eventmesh-panels.png

* update eventmesh-panels.png (apache#363)

* [ISSUE apache#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 apache#329]Missing Log4j dependency

* update eventmesh-runtime.png

* update eventmesh-panels.png

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

* add: requirements for lightweight EventMesh SDK with CloudEvents (apache#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 <[email protected]>

* Add files via upload

* Update README.md

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

* [Issue apache#337] Fix HttpSubscriber startup issue

* [Issue apache#337] test commit

* [Issue apache#337] revert test commit

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

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

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

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

* [Issue apache#368] fix build issue

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

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

Co-authored-by: j00441484 <[email protected]>

* [ISSUE apache#350]optimize flow control in downstreaming msg (apache#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 apache#380] Remove gitee-mirror.yml from Github workflows (apache#381)

* Update README.md

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

* add github action for check license

* fix syntax and name ci for Check license

* fix github action branch typo

* [ISSUE apache#310] Enable Github Actions for license check and fix license headers (apache#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 <[email protected]>

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

* [Issue apache#337] Fix HttpSubscriber startup issue

* [Issue apache#337] test commit

* [Issue apache#337] revert test commit

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

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

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

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

* [Issue apache#368] fix build issue

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

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

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

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

Co-authored-by: j00441484 <[email protected]>

* [ISSUE apache#378] downstream broadcast msg asynchronously  (apache#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 apache#378

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

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

* add license header

* add ut

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

close apache#384

* Update README.md

* Update README.zh-CN.md

* Update README.zh-CN.md

* Update README.zh-CN.md

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

* [Issue apache#337] Fix HttpSubscriber startup issue

* [Issue apache#337] test commit

* [Issue apache#337] revert test commit

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

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

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

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

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

* [Issue apache#386] Fix license header missing issue

Co-authored-by: j00441484 <[email protected]>

* [ISSUE apache#366 ] remove custom-format topic concept (apache#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 apache#366] remove custom concept [dcn&&region] (apache#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 apache#366

* [ISSUE apache#391] Optimize interface design in eventmesh-connector-api (apache#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 apache#391

* miss group name set for userAgent (apache#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 apache#393]:perf topic name in test file (apache#394)

close apache#393

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

* [ISSUE apache#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 apache#329]Missing Log4j dependency

* update eventmesh-runtime.png

* support unsubscribe topics while delconsumer in http mode

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

* [ISSUE apache#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 apache#329]Missing Log4j dependency

* update eventmesh-runtime.png

* support unsubscribe topics while delconsumer in http mode

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

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

Co-authored-by: jonyang(杨军) <[email protected]>
Co-authored-by: MajorHe1 <[email protected]>
Co-authored-by: mike_xwm <[email protected]>
Co-authored-by: Eason Chen <[email protected]>
Co-authored-by: Heng Du <[email protected]>
Co-authored-by: Udesh Liyanaarachchi <>
Co-authored-by: keranbingaa <[email protected]>
Co-authored-by: sunxi <[email protected]>
Co-authored-by: sanchen <[email protected]>
Co-authored-by: surilli(李慧敏) <[email protected]>
Co-authored-by: Lan Liang <[email protected]>
Co-authored-by: zhangxiaopengmm <[email protected]>
Co-authored-by: nanoxiong <[email protected]>
Co-authored-by: chenyi19851209 <[email protected]>
Co-authored-by: yangjun <[email protected]>
Co-authored-by: Steve Yurong Su <[email protected]>
Co-authored-by: von gosling <[email protected]>
Co-authored-by: jonyangx <[email protected]>
Co-authored-by: ruanwenjun <[email protected]>
Co-authored-by: jinrongluo <[email protected]>
Co-authored-by: j00441484 <[email protected]>
Co-authored-by: Yuzhou Mao <[email protected]>
Co-authored-by: lrhkobe <[email protected]>
Co-authored-by: Steve Yurong Su <[email protected]>
Co-authored-by: Lan <[email protected]>

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

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

* code polish and fix typo

* merge remote 1.3.0

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

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

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

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

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

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

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

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

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

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

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

* fix typo (apache#423)

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

* [ISSUE apache#418]Refactor the plugin load code

* fix ut

* [ISSUE apache#405]modify the doc (apache#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 <[email protected]>
Co-authored-by: jonyang(杨军) <[email protected]>
Co-authored-by: MajorHe1 <[email protected]>
Co-authored-by: mike_xwm <[email protected]>
Co-authored-by: Eason Chen <[email protected]>
Co-authored-by: Heng Du <[email protected]>
Co-authored-by: keranbingaa <[email protected]>
Co-authored-by: sunxi <[email protected]>
Co-authored-by: sanchen <[email protected]>
Co-authored-by: surilli(李慧敏) <[email protected]>
Co-authored-by: Lan Liang <[email protected]>
Co-authored-by: zhangxiaopengmm <[email protected]>
Co-authored-by: nanoxiong <[email protected]>
Co-authored-by: chenyi19851209 <[email protected]>
Co-authored-by: yangjun <[email protected]>
Co-authored-by: Steve Yurong Su <[email protected]>
Co-authored-by: von gosling <[email protected]>
Co-authored-by: jonyangx <[email protected]>
Co-authored-by: ruanwenjun <[email protected]>
Co-authored-by: jinrongluo <[email protected]>
Co-authored-by: j00441484 <[email protected]>
Co-authored-by: Yuzhou Mao <[email protected]>
Co-authored-by: lrhkobe <[email protected]>
Co-authored-by: Steve Yurong Su <[email protected]>
Co-authored-by: Lan <[email protected]>
Co-authored-by: YuDong Tang <[email protected]>
  • Loading branch information
27 people authored and jjz921024 committed Jul 25, 2021
1 parent e34c7b8 commit a80055e
Show file tree
Hide file tree
Showing 63 changed files with 1,397 additions and 195 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 a80055e

Please sign in to comment.