RabbitMQ

spring boot 2.2.* 项目搭建 RabbitMQ

浪子不回头ぞ 提交于 2020-02-20 13:10:35
spring boot 2.2.* 项目搭建 RabbitMQ docker pull rabbitmq:management docker run --name rabbitmq -d -p 15672 : 15672 -p 5672 : 5672 rabbitmq:management docker stop rabbitmq 停止服务 docker start rabbitmq 启动服务 docker restart rabbitmq 重启服务 docker top rabbitmq 查看状态 访问地址: http://localhost:15672 user: guest pass : guest 2 如果服务器关闭,第二天发现报错: 我的解决方案是删除这个容器。 列出所有的容器: docker ps - a 删除提示的容器: docker rm XXXXXXXXX 启动新的容器: docker run -- name - d - p 15672 : 15672 - p 5672 : 5672 rabbitmq : mangerment rabbitmq 启动成功后: 项目会提示如下信息: 这里注意如果是centos 操作系统 ,服务器的网卡默认是关闭状况需要手动开启 。 来源: CSDN 作者: 于立子 链接: https://blog.csdn.net

rabbitmq用户及vhost配置

旧时模样 提交于 2020-02-20 08:21:36
文章目录 用户 添加用户 配置virtual hosts 授权用户访问vhost 控制台简单说明 用户 上一节我们是通过guest用户登录的,但是实际工作中肯定不能以该账户使用,通常是会设置多个账户供不同的业务方使用。 下图中可以看到guest是administrator权限。 添加用户 我这里作为演示,添加一个admin用户,tags(就是角色)选的是admin(直接点击下面的几个选项即可)。 rabbitmq角色说明: 超级管理员(administrator) 可登陆管理控制台,可查看所有的信息,并且可以对用户,策略(policy)进行操作。 监控者(monitoring) 可登陆管理控制台,同时可以查看rabbitmq节点的相关信息(进程数,内存使用情况,磁盘使用情况等) 策略制定者(policymaker) 可登陆管理控制台, 同时可以对policy进行管理。但无法查看节点的相关信息(上图红框标识的部分)。 普通管理者(management) 仅可登陆管理控制台,无法看到节点信息,也无法对策略进行管理。 其他 无法登陆管理控制台,通常就是普通的生产者和消费者。 添加完成后: 可以看到 virtual hosts 显示 no access 。那么接下来配置 virtual hosts 配置virtual hosts 我这里添加了一个名为 /admin_vhost 的vhost

RabbitMQ Web STOMP without SockJS

橙三吉。 提交于 2020-02-20 05:45:50
问题 Is it possible to setup RabbitMQ Web STOMP connection without SockJS library? I have played around with rabbitmq-web-stomp plugin without a success as the initial response generated by the server is Welcome to SockJS! (which is obviously not a STOMP based message). Is SockJS really required? What does it bring into the game (besides legacy browser support)? 回答1: SockJS protocol does support raw WebSocket clients under /websocket path. Any SockJS server complying with 0.3 protocol does support

RabbitMQ Web STOMP without SockJS

落花浮王杯 提交于 2020-02-20 05:44:56
问题 Is it possible to setup RabbitMQ Web STOMP connection without SockJS library? I have played around with rabbitmq-web-stomp plugin without a success as the initial response generated by the server is Welcome to SockJS! (which is obviously not a STOMP based message). Is SockJS really required? What does it bring into the game (besides legacy browser support)? 回答1: SockJS protocol does support raw WebSocket clients under /websocket path. Any SockJS server complying with 0.3 protocol does support

I need to mock a RabbitMQ in my unit Test

和自甴很熟 提交于 2020-02-19 14:17:52
问题 I am using a RabbitMQ in my project. I have in my consumer the code of the client part of rabbitMQ and the connection need a tls1.1 to connect with the real MQ. I want to test this code in my JUnit test and to mock the message delivery to my consumer. I see in google several examples with different tools how camel rabbit or activeMQ but this tools works with amqp 1.0 and rabbitMQ only works in amqp 0.9 . Someone had this problem? Thanks! UPDATE This is the code to testing to receive a json

I need to mock a RabbitMQ in my unit Test

六月ゝ 毕业季﹏ 提交于 2020-02-19 14:16:50
问题 I am using a RabbitMQ in my project. I have in my consumer the code of the client part of rabbitMQ and the connection need a tls1.1 to connect with the real MQ. I want to test this code in my JUnit test and to mock the message delivery to my consumer. I see in google several examples with different tools how camel rabbit or activeMQ but this tools works with amqp 1.0 and rabbitMQ only works in amqp 0.9 . Someone had this problem? Thanks! UPDATE This is the code to testing to receive a json

I need to mock a RabbitMQ in my unit Test

江枫思渺然 提交于 2020-02-19 14:15:19
问题 I am using a RabbitMQ in my project. I have in my consumer the code of the client part of rabbitMQ and the connection need a tls1.1 to connect with the real MQ. I want to test this code in my JUnit test and to mock the message delivery to my consumer. I see in google several examples with different tools how camel rabbit or activeMQ but this tools works with amqp 1.0 and rabbitMQ only works in amqp 0.9 . Someone had this problem? Thanks! UPDATE This is the code to testing to receive a json

Python Day11

落花浮王杯 提交于 2020-02-19 07:29:44
RabbitMQ队列   安装 http://www.rabbitmq.com/install-standalone-mac.html 安装python rabbitMQ module ? 1 2 3 4 5 6 7 pip install pika or easy_install pika or 源码 https: / / pypi.python.org / pypi / pika 实现最简单的队列通信 send端 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #!/usr/bin/env python import pika connection = pika.BlockingConnection(pika.ConnectionParameters( 'localhost' )) channel = connection.channel() #声明queue channel.queue_declare(queue = 'hello' ) #n RabbitMQ a message can never be sent directly to the queue, it always needs to go through an exchange. channel.basic_publish(exchange = '', routing_key

RabbitMQ | 消息队列模式简介

痴心易碎 提交于 2020-02-19 07:11:49
“Hello World” 简单队列,特点是一个生产者对应一个消费者,就一个生产者P发送消息到queue,一个消费者接收 http://next.rabbitmq.com/tutorials/tutorial-one-java.html “Work queue” 工作队列模式,特点是一个生产者对应多个消费者,多个消费者共同消费一个队列,默认情况下队列循环发送给消费者 http://next.rabbitmq.com/tutorials/tutorial-two-java.html "Publish/Subscribe" 发布/订阅模式,特点是一个生产者对应多个队列及消费者,一个生产者发布的消息会被多个消费者获取。 http://next.rabbitmq.com/tutorials/tutorial-three-java.html 教程包含Publish/Subscribe,Exchanges,Temporary queues,Bindings “Routing” 路由模式, 特点是生产者发送消息到交换机并且要指定路由key,消费者将队列绑定到交换机时需要指定路由key http://next.rabbitmq.com/tutorials/tutorial-four-java.html 教程包含Routing、Bindings “Topics” 通配符模式,

RabbitMQ的应用场景

痴心易碎 提交于 2020-02-19 06:42:34
1.背景 RabbitMQ是一个由erlang开发的AMQP(Advanved Message Queue)的开源实现。 2.应用场景 2.1异步处理 场景说明:用户注册后,需要发注册邮件和注册短信,传统的做法有两种1.串行的方式;2.并行的方式 (1)串行方式:将注册信息写入数据库后,发送注册邮件,再发送注册短信,以上三个任务全部完成后才返回给客户端。 这有一个问题是,邮件,短信并不是必须的,它只是一个通知,而这种做法让客户端等待没有必要等待的东西. (2)并行方式:将注册信息写入数据库后,发送邮件的同时,发送短信,以上三个任务完成后,返回给客户端,并行的方式能提高处理的时间。 假设三个业务节点分别使用50ms,串行方式使用时间150ms,并行使用时间100ms。虽然并性已经提高的处理时间,但是,前面说过,邮件和短信对我正常的使用网站没有任何影响,客户端没有必要等着其发送完成才显示注册成功,英爱是写入数据库后就返回. (3)消息队列 引入消息队列后,把发送邮件,短信不是必须的业务逻辑异步处理 由此可以看出,引入消息队列后,用户的响应时间就等于写入数据库的时间+写入消息队列的时间(可以忽略不计),引入消息队列后处理后,响应时间是串行的3倍,是并行的2倍。 2.2 应用解耦 场景:双11是购物狂节,用户下单后,订单系统需要通知库存系统,传统的做法就是订单系统调用库存系统的接口.