接上一篇:企业实战01_SSM整合ActiveMQ支持多种类型消息https://blog.csdn.net/weixin_40816738/article/details/100557400
ActiveMQ支持消息类型如下:
1、StreamMessage java原始值数据流
2、MapMessage 键值对
3、TextMessage 字符串
4、ObjectMessage 一个序列化的java对象
5、BytesMessage 一个字节的数据流
此文章为企业实战的展示操作,如果有地方不懂请留言,我看到后,会进行统一回复,让我们一起进步,为自己加油!!!
项目名 | 项目说明 |
---|---|
ssm-activemq | 父工程,统一版本控制 |
producer | 生产者 |
consumer | 消费者 |
base-pojo | 公共实体类 |
base-dao | 公共接口,数据库连接 |
文章目录
- 二、父工程搭建ssm-activemq
- 2.1. 创建父工程
- 2.2. 添加依赖
- 2.3. 创建producer子工程
- 2.4. 添加依赖
- 2.5. 创建子工程consumer
- 2.6. 添加依赖
- 2.7. 创建子项目base-pojo
- 2.8. 添加依赖
- 2.9. 创建子工程
- 2.10. 添加依赖
二、父工程搭建ssm-activemq
2.1. 创建父工程
2.2. 添加依赖
<?xml version="1.0" encoding="UTF-8"?>
<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><groupId>com.gblfy.ssm.activemq</groupId><artifactId>ssm-activemq</artifactId><packaging>pom</packaging><version>1.0-SNAPSHOT</version><modules><module>consumer</module><module>producer</module><module>base-pojo</module><module>base-dao</module></modules><!-- 集中定义依赖版本号 --><properties><junit.version>4.12</junit.version><spring.version>4.2.4.RELEASE</spring.version><servlet-api.version>2.5</servlet-api.version><druid.version>1.0.9</druid.version><commons-fileupload.version>1.3.1</commons-fileupload.version></properties><dependencyManagement><dependencies><!-- Spring --><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-beans</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-aspects</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jms</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId><version>${spring.version}</version></dependency><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.9</version></dependency><dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><version>1.2.28</version></dependency><dependency><groupId>javassist</groupId><artifactId>javassist</artifactId><version>3.11.0.GA</version></dependency><dependency><groupId>commons-codec</groupId><artifactId>commons-codec</artifactId><version>1.10</version></dependency><dependency><groupId>javax.servlet</groupId><artifactId>servlet-api</artifactId><version>2.5</version><scope>provided</scope></dependency><!-- 连接池 --><dependency><groupId>com.alibaba</groupId><artifactId>druid</artifactId><version>${druid.version}</version></dependency></dependencies></dependencyManagement><build><plugins><!-- java编译插件 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.2</version><configuration><source>1.7</source><target>1.7</target><encoding>UTF-8</encoding><fork>true</fork><executable>C:\Program Files\Java\jdk1.8.0_202\bin\javac.exe</executable></configuration></plugin></plugins></build>
</project>
2.3. 创建producer子工程
2.4. 添加依赖
<?xml version="1.0" encoding="UTF-8"?><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"><parent><groupId>com.gblfy.ssm.activemq</groupId><artifactId>ssm-activemq</artifactId><version>1.0-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><artifactId>producer</artifactId><packaging>war</packaging><name>producer</name><url>http://www.gblfy.com</url><dependencies><dependency><groupId>com.gblfy.ssm.activemq</groupId><artifactId>base-dao</artifactId><version>1.0-SNAPSHOT</version></dependency><!-- Spring --><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-beans</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-aspects</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jms</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId></dependency><dependency><groupId>junit</groupId><artifactId>junit</artifactId></dependency><!--解析--><dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId></dependency><dependency><groupId>javassist</groupId><artifactId>javassist</artifactId></dependency><dependency><groupId>commons-codec</groupId><artifactId>commons-codec</artifactId></dependency><dependency><groupId>javax.servlet</groupId><artifactId>servlet-api</artifactId><scope>provided</scope></dependency><!--MQ依赖--><dependency><groupId>org.apache.activemq</groupId><artifactId>activemq-client</artifactId><version>5.13.4</version></dependency><!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api --><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId><version>1.7.25</version></dependency></dependencies><build><plugins><plugin><groupId>org.apache.tomcat.maven</groupId><artifactId>tomcat7-maven-plugin</artifactId><version>2.2</version><configuration><!-- 指定端口 --><port>8080</port><!-- 请求路径 --><path>/</path></configuration></plugin></plugins></build>
</project>
2.5. 创建子工程consumer
2.6. 添加依赖
<?xml version="1.0" encoding="UTF-8"?><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"><parent><groupId>com.gblfy.ssm.activemq</groupId><artifactId>ssm-activemq</artifactId><version>1.0-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><artifactId>consumer</artifactId><packaging>war</packaging><name>consumer</name><url>http://www.gblfy.com</url><dependencies><dependency><groupId>com.gblfy.ssm.activemq</groupId><artifactId>base-dao</artifactId><version>1.0-SNAPSHOT</version></dependency><!-- Spring --><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-beans</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-aspects</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jms</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId></dependency><dependency><groupId>junit</groupId><artifactId>junit</artifactId></dependency><!--解析--><dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId></dependency><dependency><groupId>javassist</groupId><artifactId>javassist</artifactId></dependency><dependency><groupId>commons-codec</groupId><artifactId>commons-codec</artifactId></dependency><dependency><groupId>javax.servlet</groupId><artifactId>servlet-api</artifactId><scope>provided</scope></dependency><!--MQ依赖--><dependency><groupId>org.apache.activemq</groupId><artifactId>activemq-client</artifactId><version>5.13.4</version></dependency><!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api --><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId><version>1.7.25</version></dependency></dependencies><build><plugins><plugin><groupId>org.apache.tomcat.maven</groupId><artifactId>tomcat7-maven-plugin</artifactId><version>2.2</version><configuration><!-- 指定端口 --><port>9005</port><!-- 请求路径 --><path>/</path></configuration></plugin></plugins></build>
</project>
2.7. 创建子项目base-pojo
2.8. 添加依赖
<?xml version="1.0" encoding="UTF-8"?><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"><parent><artifactId>ssm-activemq</artifactId><groupId>com.gblfy.ssm.activemq</groupId><version>1.0-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><artifactId>base-pojo</artifactId><name>mq-pojo</name><!-- FIXME change it to the project's website --><url>http://www.example.com</url><dependencies><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.16.12</version></dependency><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus</artifactId><version>3.1.2</version></dependency></dependencies>
</project>
2.9. 创建子工程
2.10. 添加依赖
<?xml version="1.0" encoding="UTF-8"?><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"><parent><artifactId>ssm-activemq</artifactId><groupId>com.gblfy.ssm.activemq</groupId><version>1.0-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><artifactId>base-dao</artifactId><name>base-dao</name><url>http://www.gblfy.com</url><dependencies><dependency><groupId>com.gblfy.ssm.activemq</groupId><artifactId>base-pojo</artifactId><version>1.0-SNAPSHOT</version></dependency><!--Mysql 数据库 Start--><dependency><groupId>com.alibaba</groupId><artifactId>druid</artifactId><version>1.1.19</version></dependency><!-- mysql 数据库驱动--><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>8.0.16</version></dependency><!--Mysql 数据库 End--></dependencies>
</project>
到此,依赖和工程都搭建完成了!!!
接下一篇:企业实战03_SSM整合ActiveMQ支持多种类型消息https://blog.csdn.net/weixin_40816738/article/details/100572104
本专栏项目下载链接:
下载方式 | 链接详细 |
---|---|
GitLab项目 | https://gitlab.com/gb-heima/ssm-activemq |
Git | git clone git@gitlab.com:gb-heima/ssm-activemq.git |
zip包 | https://gitlab.com/gb-heima/ssm-activemq/-/archive/master/ssm-activemq-master.zip |
Fork地址 | https://gitlab.com/gb-heima/ssm-activemq/-/forks/new |