如非授权,禁止用于商业用途,转载请注明出处
作者:mynewworldyyl
JMICRO运行简单服务提供者和消费者
1. 下载源代码
git checkout https://github.com/mynewworldyyl/jmicro.git
也可以直接在Github上直接下载源码解压到某个目录
2. 构建JMicro全部依赖包
进入到下载的源码目录,执行如下命令:
maven clean install
3. 启动Zookeeper,端口保持默认值2181
参考:https://zookeeper.apache.org/doc/r3.4.13/zookeeperStarted.html
4. 启动Redis,端口保持默认值6379
Linux: https://redis.io/download
Windows: https://github.com/MicrosoftArchive/redis/releases
5. 构建运行服务提供方
打开命令行窗口
进入provider目录
cd ${SRC_ROOT}\jmicro.example\jmicro.example.provider
构建运行包
mvn clean install -Pbuild-main
运行服务
java -jar target/jmicro.example.provider-0.0.1-SNAPSHOT-jar-with-dependencies.jar
6. 构建运行服务消费方
打开一个新命令行窗口
进入comsumer目录
cd ${SRC_ROOT}\jmicro.example\jmicro.example.comsumer
构建运行包
mvn clean install -Pbuild-main
7. 运行消费方
java -jar target/jmicro.example.comsumer-0.0.1-SNAPSHOT-jar-with-dependencies.jar
最后一行看到如下输出 ,即服务提供方返回的消息
Server say hello to: Hello JMicro