File tree 6 files changed +147
-0
lines changed
6 files changed +147
-0
lines changed Original file line number Diff line number Diff line change
1
+ HELP.md
2
+ /target /
3
+ ! .mvn /wrapper /maven-wrapper.jar
4
+
5
+ # ## STS ###
6
+ .apt_generated
7
+ .classpath
8
+ .factorypath
9
+ .project
10
+ .settings
11
+ .springBeans
12
+ .sts4-cache
13
+
14
+ # ## IntelliJ IDEA ###
15
+ .idea
16
+ * .iws
17
+ * .iml
18
+ * .ipr
19
+
20
+ # ## NetBeans ###
21
+ /nbproject /private /
22
+ /nbbuild /
23
+ /dist /
24
+ /nbdist /
25
+ /.nb-gradle /
26
+ /build /
27
+
28
+ # ## VS Code ###
29
+ .vscode /
Original file line number Diff line number Diff line change
1
+ ## SpringBoot整合RabbitMQ
2
+
3
+ RabbitMQ是基于AMQP的一款消息管理系统,RabbitMQ基于Erlang语言开发,安装之前需要先安装Erlang的相关依赖。
4
+
5
+ RabbitMQ提供了6种消息模型,但是第6种其实是RPC,并不是MQ,因此不予学习。那么也就剩下5种。
6
+
7
+ 但是其实3、4、5这三种都属于订阅模型,只不过进行路由的方式不同。
8
+
9
+ [ RabbitMQ官网] ( http://www.rabbitmq.com/# )
10
+ [ RabbitMQ官方教程] ( http://www.rabbitmq.com/getstarted.html# )
11
+ [ RabbitMQ下载地址] ( http://www.rabbitmq.com/download.html# )
12
+ [ Erlang下载地址] ( http://www.erlang.org/download.html# )
13
+ [ RabbitMQ相关知识讲解] ( https://blog.csdn.net/qq_38762237/article/details/89416444# )
14
+ [ RabbitMQ在Windows的安装教程] ( https://blog.csdn.net/weixin_39735923/article/details/79288578# )
15
+
16
+ ## 准备
17
+
18
+ 参照上面安装教程的讲解,安装好以下三个软件:
19
+
20
+ - Erlang,由于是基于Erlang的中间件,所以必须安装,且配置环境变量
21
+ - RabbitMQ,双击安装,默认的即可
22
+ - sbin目录下安装图形界面:使用rabbitmq-plugins enable rabbitmq_management命令进行安装
23
+
24
+ 运行sbin/rabbitmq-server
25
+
26
+ 使用浏览器访问:http://localhost:15672,默认登录用户名:guest,密码为:guest
27
+
28
+ ** 添加用户**
29
+
30
+ admin模块下添加一个用户,建议和我使用一样的,避免之后产生混淆:
31
+
32
+ | 属性| 值|
33
+ | :--| :--|
34
+ | Username| tellsea|
35
+ | password| 123456|
36
+ Tags|administrator|
37
+
38
+ ** 创建虚拟主机**
39
+
40
+ Virtual Hosts名称设置为:/tellsea-host,点击主机名称授权用户tellsea
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3
+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
4
+ <modelVersion >4.0.0</modelVersion >
5
+ <parent >
6
+ <groupId >org.springframework.boot</groupId >
7
+ <artifactId >spring-boot-starter-parent</artifactId >
8
+ <version >2.1.3.RELEASE</version >
9
+ <relativePath /> <!-- lookup parent from repository -->
10
+ </parent >
11
+ <groupId >cn.tellsea</groupId >
12
+ <artifactId >springboot-rabbitmq</artifactId >
13
+ <version >0.0.1-SNAPSHOT</version >
14
+ <name >springboot-rabbitmq</name >
15
+ <description >Demo project for Spring Boot</description >
16
+
17
+ <properties >
18
+ <java .version>1.8</java .version>
19
+ </properties >
20
+
21
+ <dependencies >
22
+ <dependency >
23
+ <groupId >org.springframework.boot</groupId >
24
+ <artifactId >spring-boot-starter-web</artifactId >
25
+ </dependency >
26
+
27
+ <dependency >
28
+ <groupId >org.springframework.boot</groupId >
29
+ <artifactId >spring-boot-starter-test</artifactId >
30
+ <scope >test</scope >
31
+ </dependency >
32
+
33
+ <dependency >
34
+ <groupId >org.springframework.boot</groupId >
35
+ <artifactId >spring-boot-starter-amqp</artifactId >
36
+ </dependency >
37
+ </dependencies >
38
+
39
+ <build >
40
+ <plugins >
41
+ <plugin >
42
+ <groupId >org.springframework.boot</groupId >
43
+ <artifactId >spring-boot-maven-plugin</artifactId >
44
+ </plugin >
45
+ </plugins >
46
+ </build >
47
+
48
+ </project >
Original file line number Diff line number Diff line change
1
+ package cn .tellsea ;
2
+
3
+ import org .springframework .boot .SpringApplication ;
4
+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
5
+
6
+ @ SpringBootApplication
7
+ public class SpringbootRabbitmqApplication {
8
+
9
+ public static void main (String [] args ) {
10
+ SpringApplication .run (SpringbootRabbitmqApplication .class , args );
11
+ }
12
+
13
+ }
Original file line number Diff line number Diff line change
1
+
Original file line number Diff line number Diff line change
1
+ package cn .tellsea ;
2
+
3
+ import org .junit .Test ;
4
+ import org .junit .runner .RunWith ;
5
+ import org .springframework .boot .test .context .SpringBootTest ;
6
+ import org .springframework .test .context .junit4 .SpringRunner ;
7
+
8
+ @ RunWith (SpringRunner .class )
9
+ @ SpringBootTest
10
+ public class SpringbootRabbitmqApplicationTests {
11
+
12
+ @ Test
13
+ public void contextLoads () {
14
+ }
15
+
16
+ }
You can’t perform that action at this time.
0 commit comments