64bit OS, Linux/Unix is recommended;
64bit JDK 1.8+;
Gradle at least 7.0, eg 7.0.*
download source code from https://github.com/apache/incubator-eventmesh
You will get EventMesh-master.zip
unzip EventMesh-master.zip
cd /*YOUR DEPLOY PATH*/EventMesh-master
gradle clean dist copyConnectorPlugin tar -x test
You will get EventMesh_1.2.0.tar.gz in directory /* YOUR DEPLOY PATH */EventMesh-master/build
- deploy eventmesh-runtime
upload Eventmesh_1.2.0.tar.gz
tar -zxvf Eventmesh_1.2.0.tar.gz
cd conf
config your eventMesh.properties
cd ../bin
sh start.sh
If you see "EventMeshTCPServer[port=10000] started....", you setup runtime successfully.
Same with 1.1, but it can be only compiled in JDK 1.8
Same with 1.2
2.3.1 Project structure:
- eventmesh-common : eventmesh common classes and method module
- eventmesh-connector-api : eventmesh connector api definition module
- eventmesh-connector-plugin : eventmesh connector plugin instance module
- 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 plugin module follows the eventmesh SPI specification, custom SPI interface need to be identified with the @EventMeshSPI annotation. The plugin instance needs to be configured in corresponding module under /main/resources/meta-inf/eventmesh with the mapping file of related interface and implementation class. The content of the file is a mapping of plugin instance name to plugin instance, you can find more detail in eventmesh-connector-rocketmq module
The plugin can be loaded from classpath and plugin directory. In local develop, you can declare the used plugins in build.gradle of eventmesh-starter module, or execute copyConnectorPlugin task of gradle to copy the plugin instance jar to dist/plugin directory. By default, eventmesh will load the plugins in project's dist/plugin, this can be changed by add -DeventMeshPluginDir=your_plugin_directory. The plugin instance need to be used at runtime can be configured in eventmesh.properties. If you need to use rokectmq plugin to start eventmesh-runtime, you need to declare the dependcy in build.gradle of eventmesh-starter module.
implementation project(":eventmesh-connector-plugin:eventmesh-connector-rocketmq")
2.3.2 Configure plugin
-Deventmesh.log.home=eventmesh-runtime/logs
Specify the connector plugin that will be loaded after the project start by declaring in eventMesh.properties
Modify the eventMesh.properties
file in the confPath
directory
load rocketmq connector configuration:
#connector plugin
eventMesh.connector.plugin.type=rocketmq
2.3.3 Configure VM Options
-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
running org.apache.eventmesh.starter.StartUp
main method
execute docker pull eventmesh/eventmesh-rocketmq:v1.2.0
, you will get EventMesh image like below
prerequisite : may be you need download the source code from git first and use the contents of these files(eventMesh.properties and rocketmq-client.properties) as a reference for the following actions.
3.2.1 Files to configure
Before run the container you should configure some files.
eventMesh.properties
Configuration Key | Default Value | Remarks |
---|---|---|
eventMesh.server.http.port | 10105 | EventMesh http server port |
eventMesh.server.tcp.port | 10000 | EventMesh tcp server port |
rocketmq-client.properties
Configuration Key | Default Value | Remarks |
---|---|---|
eventMesh.server.rocketmq.namesrvAddr | 127.0.0.1:9876;127.0.0.1:9876 | RocketMQ namesrv default address |
After pull the EventMesh image to your host machine, you can execute command below to configure eventMesh.properties and rocketmq-client.properties
3.2.2 Create Files
mkdir -p /data/eventmesh/rocketmq/conf
cd /data/eventmesh/rocketmq/conf
vi eventMesh.properties
vi rocketmq-client.properties
The contents of these files can reference from eventMesh.properties and rocketmq-client.properties
3.3.1 run
execute command below to run container
docker run -d -p 10000:10000 -p 10105:10105 -v /data/eventmesh/rocketmq/conf/eventMesh.properties:/data/app/eventmesh/conf/eventMesh.properties -v /data/eventmesh/rocketmq/conf/rocketmq-client.properties:/data/app/eventmesh/conf/rocketmq-client.properties docker.io/eventmesh/eventmesh-rocketmq:v1.2.0
-p : binding the container port with host machine port
-v : mount the container configuration files with host machine files
3.3.2 check container
execute docker ps
to check the container health
execute docker logs [container id]
you will get following result:
execute docker exec -it [container id] /bin/bash
you will go into the container and see the details:
Prerequisite :RocketMQ Namesrv & Broker
you can build the rocketmq image following here or get the rocketmq image from docker hub.
docker pull rocketmqinc/rocketmq-namesrv:4.5.0-alpine
docker pull rocketmqinc/rocketmq-broker:4.5.0-alpine
#namesrv
docker run -d -p 9876:9876 -v `pwd` /data/namesrv/logs:/root/logs -v `pwd`/data/namesrv/store:/root/store --name rmqnamesrv rocketmqinc/rocketmq-namesrv:4.5.0-alpine sh mqnamesrv
#broker
docker run -d -p 10911:10911 -p 10909:10909 -v `pwd`/data/broker/logs:/root/logs -v `pwd`/data/broker/store:/root/store --name rmqbroker --link rmqnamesrv:namesrv -e "NAMESRV_ADDR=namesrv:9876" rocketmqinc/rocketmq-broker:4.5.0-alpine sh mqbroker -c ../conf/broker.conf
When we get this point, rocketmq-broker ip is the pod ip, if you want to change the ip, you can mount the ** broker.conf** file in container and modify brokerIP1 configuration in this file to your custom values.
3.4.1 Run Demo
Windows
- For demos running under the Windows , you can refer here
Linux
-
Get eventmesh-test_1.2.0-SNAPSHOT.tar.gz
you can get this package from our releases or build with source code.
build with source code:
cd /* Your Deploy Path */EventMesh/eventmesh-test gradle clean testdist testtar -x test`
you will get eventmesh-test_1.2.0-SNAPSHOT.tar.gz under the /eventmesh-test/build
-
Modify configuration files
upload eventmesh-test_1.2.0-SNAPSHOT.tar.gz tar -zxvf eventmesh-test_1.2.0-SNAPSHOT.tar.gz cd conf config your application.properties
-
Run demo
TCP Sub
cd bin sh tcp_sub.sh
TCP Pub
cd bin sh tcp_pub.sh
TCP Sub Broadcast
cd bin sh tcp_sub_broadcast.sh
TCP Pub Broadcast
cd bin sh tcp_pub_broadcast.sh
HTTP Sub
cd bin sh http_sub.sh
HTTP Pub
cd bin sh http_pub.sh
After this , you can see result of different mode in logs file under
/logs
directory