Spring 初探(5) rabbitMq

RabbitMq
windows版本:
1.安装erl 下载地址:http://www.erlang.org/downloads
2.安装RabbitMq 下载地址:http://www.rabbitmq.com/
3.安装RabbitMq Plugin
rabbitmq-plugins enable rabbitmq_management
信息: 用提供的模式无法找到文件。
系统找不到指定的路径。

******************************
ERLANG_HOME not set correctly.
******************************

Please either set ERLANG_HOME to point to your Erlang installation or place the
RabbitMQ server distribution in the Erlang lib folder.
4.将ERLANG_HOME设置到rabbitmq-env.bat中
5.rabbitmq-plugins enable rabbitmq_management执行
Plugin configuration unchanged.
Applying plugin configuration to rabbit@XXXXX-PC... failed.
* Could not contact node rabbit@XXXXX-PC.
Changes will take effect at broker restart.
* Options: --online - fail if broker cannot be contacted.
--offline - do not try to contact broker.
6.将windows中的.erlang.cookies复制到用户目录下
7.rabbitmq-plugins enable rabbitmq_management执行
Plugin configuration unchanged.
Applying plugin configuration to rabbit@XXXXX-PC... nothing to do.
网上资料说这个样子成功
8.8.创建人:rabbitmqctl add_user admin 123456
9.设置权限:
rabbitmqctl set_user_tags admin administrator
rabbitmqctl set_permissions -p "/" admin ".*" ".*" ".*"
10.rabbitmq-server.bat
RabbitMQ 3.6.14. Copyright (C) 2007-2017 Pivotal Software, Inc.
## ## Licensed under the MPL. See http://www.rabbitmq.com/
## ##
###### ## C:/Users/AXXXX/AppData/Roaming/RabbitMQ/log/RABBIT~3.LOG
##########
11.经查看日志 Rabbit 服务启动成功.
12.浏览器打开:http://localhost:15672/ 使用admin 123456 登录
13.代码级别:
pom.xml 添加:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
<version>1.3.1.RELEASE</version>
</dependency>
发送代码:
amqpTemplate.convertAndSend(EXCHANGE,ROUTINGKEY,消息);注意exchang和routingkey,可以至少确定一个queue(此操作可在界面直接操作),发送消息后,可以在queue中查看信息。


git地址:https://github.com/leaf-it/demo-rabbitmq.git
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值