Compare commits
2 Commits
2a79fca22c
...
e11d7b703f
| Author | SHA1 | Date | |
|---|---|---|---|
| e11d7b703f | |||
| 12e38067ab |
61
docker-compose.yml
Normal file
61
docker-compose.yml
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
# NameServer 服务
|
||||||
|
rocketmq-namesrv:
|
||||||
|
image: apache/rocketmq:5.2.0
|
||||||
|
container_name: rocketmq-namesrv
|
||||||
|
ports:
|
||||||
|
- "9876:9876"
|
||||||
|
# 移除挂载配置
|
||||||
|
command: sh mqnamesrv
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
- rocketmq-network
|
||||||
|
environment:
|
||||||
|
- TZ=Asia/Shanghai
|
||||||
|
# 调整JVM内存,避免内存不足
|
||||||
|
- ROCKETMQ_OPT="-Xms256m -Xmx256m -Xmn128m"
|
||||||
|
|
||||||
|
# Broker 服务
|
||||||
|
rocketmq-broker:
|
||||||
|
image: apache/rocketmq:5.2.0
|
||||||
|
container_name: rocketmq-broker
|
||||||
|
ports:
|
||||||
|
- "10911:10911"
|
||||||
|
- "10909:10909"
|
||||||
|
# 移除挂载配置,直接通过环境变量传递核心配置
|
||||||
|
command: >
|
||||||
|
sh mqbroker -n rocketmq-namesrv:9876
|
||||||
|
-c /home/rocketmq/conf/broker.conf
|
||||||
|
-Drocketmq.broker.ip1=你的服务器IP
|
||||||
|
-Drocketmq.broker.autoCreateTopicEnable=true
|
||||||
|
-Drocketmq.broker.autoCreateSubscriptionGroup=true
|
||||||
|
depends_on:
|
||||||
|
- rocketmq-namesrv
|
||||||
|
environment:
|
||||||
|
- TZ=Asia/Shanghai
|
||||||
|
- NAMESRV_ADDR=rocketmq-namesrv:9876
|
||||||
|
- ROCKETMQ_OPT="-Xms512m -Xmx512m -Xmn256m"
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
- rocketmq-network
|
||||||
|
|
||||||
|
# RocketMQ 控制台(端口改为8083)
|
||||||
|
rocketmq-dashboard:
|
||||||
|
image: apacherocketmq/rocketmq-dashboard:2.0.0
|
||||||
|
container_name: rocketmq-dashboard
|
||||||
|
ports:
|
||||||
|
- "8083:8080" # 宿主机8083端口映射到容器8080
|
||||||
|
environment:
|
||||||
|
- NAMESRV_ADDR=rocketmq-namesrv:9876
|
||||||
|
- TZ=Asia/Shanghai
|
||||||
|
depends_on:
|
||||||
|
- rocketmq-namesrv
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
- rocketmq-network
|
||||||
|
|
||||||
|
networks:
|
||||||
|
rocketmq-network:
|
||||||
|
driver: bridge
|
||||||
28
pay-service/pom.xml
Normal file
28
pay-service/pom.xml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>cn.mayiming</groupId>
|
||||||
|
<artifactId>javamemories-parent</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>pay-service</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>pay-service</name>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
13
pay-service/src/main/java/cn/mayiming/App.java
Normal file
13
pay-service/src/main/java/cn/mayiming/App.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package cn.mayiming;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hello world!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class App
|
||||||
|
{
|
||||||
|
public static void main( String[] args )
|
||||||
|
{
|
||||||
|
System.out.println( "Hello World!" );
|
||||||
|
}
|
||||||
|
}
|
||||||
38
pay-service/src/test/java/cn/mayiming/AppTest.java
Normal file
38
pay-service/src/test/java/cn/mayiming/AppTest.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package cn.mayiming;
|
||||||
|
|
||||||
|
import junit.framework.Test;
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for simple App.
|
||||||
|
*/
|
||||||
|
public class AppTest
|
||||||
|
extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create the test case
|
||||||
|
*
|
||||||
|
* @param testName name of the test case
|
||||||
|
*/
|
||||||
|
public AppTest( String testName )
|
||||||
|
{
|
||||||
|
super( testName );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the suite of tests being tested
|
||||||
|
*/
|
||||||
|
public static Test suite()
|
||||||
|
{
|
||||||
|
return new TestSuite( AppTest.class );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rigourous Test :-)
|
||||||
|
*/
|
||||||
|
public void testApp()
|
||||||
|
{
|
||||||
|
assertTrue( true );
|
||||||
|
}
|
||||||
|
}
|
||||||
2
pom.xml
2
pom.xml
@@ -93,6 +93,8 @@
|
|||||||
<module>order-service</module>
|
<module>order-service</module>
|
||||||
<module>javamemories-gateway</module>
|
<module>javamemories-gateway</module>
|
||||||
<module>request-test</module>
|
<module>request-test</module>
|
||||||
|
<module>pay-service</module>
|
||||||
|
<module>stock-service</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<!-- 编译插件(确保 Java 版本兼容) -->
|
<!-- 编译插件(确保 Java 版本兼容) -->
|
||||||
|
|||||||
28
stock-service/pom.xml
Normal file
28
stock-service/pom.xml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>cn.mayiming</groupId>
|
||||||
|
<artifactId>javamemories-parent</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>stock-service</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>stock-service</name>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
13
stock-service/src/main/java/cn/mayiming/App.java
Normal file
13
stock-service/src/main/java/cn/mayiming/App.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package cn.mayiming;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hello world!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class App
|
||||||
|
{
|
||||||
|
public static void main( String[] args )
|
||||||
|
{
|
||||||
|
System.out.println( "Hello World!" );
|
||||||
|
}
|
||||||
|
}
|
||||||
38
stock-service/src/test/java/cn/mayiming/AppTest.java
Normal file
38
stock-service/src/test/java/cn/mayiming/AppTest.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package cn.mayiming;
|
||||||
|
|
||||||
|
import junit.framework.Test;
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for simple App.
|
||||||
|
*/
|
||||||
|
public class AppTest
|
||||||
|
extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create the test case
|
||||||
|
*
|
||||||
|
* @param testName name of the test case
|
||||||
|
*/
|
||||||
|
public AppTest( String testName )
|
||||||
|
{
|
||||||
|
super( testName );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the suite of tests being tested
|
||||||
|
*/
|
||||||
|
public static Test suite()
|
||||||
|
{
|
||||||
|
return new TestSuite( AppTest.class );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rigourous Test :-)
|
||||||
|
*/
|
||||||
|
public void testApp()
|
||||||
|
{
|
||||||
|
assertTrue( true );
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user