参考自腾讯云的实验课堂,减少部署时间的折腾

1、创建Erlang.Repo库

curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash

2、安装Erlang

yum install -y erlang

3、创建RabbitMQ-Server.Repo库

curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash

4、安装RabbitMQ-Server

yum install -y rabbitmq-server 

5、开机自启动设置(可选)

chkconfig rabbitmq-server on

6、服务启动

service rabbitmq-server start

7、开启访问页面

rabbitmq-plugins enable rabbitmq_management

8、添加登录账号

rabbitmqctl add_user test 123456

9、账号权限设置

rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p "/" test ".*" ".*" ".*"

10、访问后台信息:

http://192.168.2.121:15672/
test
123456

11、服务停止

service rabbitmq-server stop

访问不了,关闭防火墙处理:

systemctl stop firewalld.service            #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动

参考腾讯云实验室,很多东西在这里搞安装教程贼方便

https://cloud.tencent.com/developer/labs/gallery

防止依赖缺失,还是加上这段命令:

yum install -y build-essential \
unixODBC \
unixODBC-devel \
kernel-devel \
m4 \
tk \
tc \
xz \
gcc \
gcc-c++ \
glibc-devel \
make \
ncurses-devel \
openssl \
openssl-devel \
xmlto \
perl \
wget \
gtk2-devel \
binutils-devel

草,一年前写了,算了算了,留着吧

https://www.cnblogs.com/mindzone/p/13660810.html

创建消费者和生产者两个服务:

消费者编写了简答模式,pom只放了RabbitMQ的客户端

(这里写错位置了,要放到生产者里面)

<?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>RabbitMQ</artifactId>
<groupId>cn.dzz</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion> <artifactId>ConsumerService</artifactId> <dependencies>
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>5.6.0</version>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties> </project>

消息队列简单模式代码:

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory; import java.nio.charset.StandardCharsets; public class RabbitMqTest { public static void main(String[] args) throws Exception{ ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setHost("192.168.2.121");
connectionFactory.setPort(ConnectionFactory.DEFAULT_AMQP_PORT); // 5672
connectionFactory.setVirtualHost("/dzz"); // 虚拟主机? 默认值 /
connectionFactory.setUsername("guest"); // guest
connectionFactory.setPassword("guest"); // guest Connection connection = connectionFactory.newConnection();
Channel channel = connection.createChannel(); /**
* public com.rabbitmq.client.AMQP.Queue.DeclareOk queueDeclare(String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments) throws IOException {
* com.rabbitmq.client.AMQP.Queue.DeclareOk ok = this.delegate.queueDeclare(queue, durable, exclusive, autoDelete, arguments);
* this.recordQueue(ok, queue, durable, exclusive, autoDelete, arguments);
* return ok;
* }
* String queue 队列名称?
* boolean durable 是否持久化? 写入Erlang的库中,否则只存活在内存中,RabbitMQ服务重启,队列销毁
* boolean exclusive 是否独占? 只允许一个消费者服务监听这个队列? Connection对象关闭 是否删除队列
* boolean autoDelete 是否自动删除? 没有消费者服务监听时自动删除
* Map<String, Object> arguments 参数信息, 自行设置
*
* 如果没有队列叫这个 hello_rabbitmq RabbitMQ会自动创建这个队列、
*/
channel.queueDeclare("hello_rabbitmq", true, false, false, null); /**
* public void basicPublish(String exchange, String routingKey, BasicProperties props, byte[] body) throws IOException {
* this.delegate.basicPublish(exchange, routingKey, props, body);
* }
* String exchange 交换机名称,简单模式 使用默认交换机 ""
* String routingKey 路由名称 (由于使用的时默认交换机,路由名称和上面的队列名称一致)
* BasicProperties props 配置信息
* byte[] body 发送的消息数据
*/
String body = "hello, rabbitMq !!!!";
channel.basicPublish("", "hello_rabbitmq", null, body.getBytes(StandardCharsets.UTF_8)); // 资源释放
channel.close();
connection.close();
}
}

注意没开始之前,队列标签页没有任何信息:

执行代码之后:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:364)
at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:64)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:156)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1106)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1063)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1021)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1182)
at RabbitMqTest.main(RabbitMqTest.java:19
) Process finished with exit code 1

访问拒绝,是因为之前已经设置了RabbitMQ的账号信息

可以先用默认账号进行登录:

它提示这个账号仅限本机访问,由于安装在Linux上面,所以是非本机访问

使用 test 123456 再次再次执行:

"C:\Program Files (x86)\Java\jdk1.8.0_291\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2021.2.1\lib\idea_rt.jar=59622:C:\Program Files\JetBrains\IntelliJ IDEA 2021.2.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\deploy.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\access-bridge-32.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\cldrdata.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\dnsns.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\jaccess.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\jfxrt.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\localedata.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\nashorn.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\sunec.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\sunjce_provider.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\sunmscapi.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\sunpkcs11.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\zipfs.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\javaws.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\jfr.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\jfxswt.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\jsse.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\management-agent.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\plugin.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\rt.jar;C:\Users\Administrator\IdeaProjects\RabbitMQ\ConsumerService\target\test-classes;C:\Users\Administrator\.m2\repository\com\rabbitmq\amqp-client\5.6.0\amqp-client-5.6.0.jar;C:\Users\Administrator\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar" RabbitMqTest
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.io.IOException
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:129)
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:125)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:147)
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:403)
at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:64)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:156)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1106)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1063)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1021)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1182)
at RabbitMqTest.main(RabbitMqTest.java:19)
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; protocol method: #method<connection.close>(reply-code=530, reply-text=NOT_ALLOWED - vhost /dzz not found, class-id=10, method-id=40)
at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:502)
at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:293)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:141)
... 8 more
Process finished with exit code 1

虚拟主机未找到 得,还不是自动创建的,需要去面板上配置:

添加虚拟主机

没有异常了,应该是发送成功了

"C:\Program Files (x86)\Java\jdk1.8.0_291\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2021.2.1\lib\idea_rt.jar=60801:C:\Program Files\JetBrains\IntelliJ IDEA 2021.2.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\deploy.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\access-bridge-32.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\cldrdata.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\dnsns.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\jaccess.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\jfxrt.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\localedata.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\nashorn.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\sunec.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\sunjce_provider.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\sunmscapi.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\sunpkcs11.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\zipfs.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\javaws.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\jfr.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\jfxswt.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\jsse.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\management-agent.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\plugin.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\rt.jar;C:\Users\Administrator\IdeaProjects\RabbitMQ\ConsumerService\target\test-classes;C:\Users\Administrator\.m2\repository\com\rabbitmq\amqp-client\5.6.0\amqp-client-5.6.0.jar;C:\Users\Administrator\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar" RabbitMqTest
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Process finished with exit code 0

查看队列面板上面就会多出一条记录:

但是连接记录和频道记录都没有,原因是我们把资源释放掉了

现在把代码释放资源的部分注释掉,程序将不会停止

面板上面就会显示连接信息和频道信息

创建消费者,接收消息:

import com.rabbitmq.client.*;

import java.io.IOException;
import java.nio.charset.StandardCharsets; public class RabbitMqTest { public static void main(String[] args) throws Exception{ ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setHost("192.168.2.121");
connectionFactory.setPort(ConnectionFactory.DEFAULT_AMQP_PORT); // 5672
connectionFactory.setVirtualHost("/dzz"); // 虚拟主机? 默认值 /
connectionFactory.setUsername("test"); // guest
connectionFactory.setPassword("123456"); // guest Connection connection = connectionFactory.newConnection();
Channel channel = connection.createChannel(); /**
* public com.rabbitmq.client.AMQP.Queue.DeclareOk queueDeclare(String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments) throws IOException {
* com.rabbitmq.client.AMQP.Queue.DeclareOk ok = this.delegate.queueDeclare(queue, durable, exclusive, autoDelete, arguments);
* this.recordQueue(ok, queue, durable, exclusive, autoDelete, arguments);
* return ok;
* }
* String queue 队列名称?
* boolean durable 是否持久化? 写入Erlang的库中,否则只存活在内存中,RabbitMQ服务重启,队列销毁
* boolean exclusive 是否独占? 只允许一个消费者服务监听这个队列? Connection对象关闭 是否删除队列
* boolean autoDelete 是否自动删除? 没有消费者服务监听时自动删除
* Map<String, Object> arguments 参数信息, 自行设置
*
* 如果没有队列叫这个 hello_rabbitmq RabbitMQ会自动创建这个队列、
*
* 对于消费者来说,队列声明不是必要的
*/
channel.queueDeclare("hello_rabbitmq", true, false, false, null); /**
* 消息接受
* public String basicConsume(String queue, boolean autoAck, Consumer callback) throws IOException {
* return this.basicConsume(queue, autoAck, "", callback);
* }
* String queue 队列名称
* boolean autoAck 是否自动确认
* Consumer callback 回调方法
*
*
*/
Consumer consumer = new DefaultConsumer(channel) {
/**
* 消息收到的回调方法(自动执行)
* @param consumerTag 标识
* @param envelope RabbitMQ服务信息
* @param properties 配置信息
* @param body 收到的数据
* @throws IOException
*/
@Override
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
System.out.println("consumerTag " + consumerTag); String exchange = envelope.getExchange();
long deliveryTag = envelope.getDeliveryTag();
String routingKey = envelope.getRoutingKey(); System.out.println("exchange " + exchange);
System.out.println("deliveryTag " + deliveryTag);
System.out.println("routingKey " + routingKey);
System.out.println("properties " + properties); System.out.println("body(message) " + new String(body, StandardCharsets.UTF_8));
System.out.println("- - - - - over - - - - -");
}
}; channel.basicConsume("hello_rabbitmq", true, consumer);
// 资源释放 消费者需要一直监听发送过来的消息,不能关闭资源
// channel.close();
// connection.close();
}
}

执行后输出打印:

从生产者发送的三条消息全部收到

"C:\Program Files (x86)\Java\jdk1.8.0_291\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2021.2.1\lib\idea_rt.jar=62981:C:\Program Files\JetBrains\IntelliJ IDEA 2021.2.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\deploy.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\access-bridge-32.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\cldrdata.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\dnsns.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\jaccess.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\jfxrt.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\localedata.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\nashorn.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\sunec.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\sunjce_provider.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\sunmscapi.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\sunpkcs11.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\ext\zipfs.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\javaws.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\jfr.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\jfxswt.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\jsse.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\management-agent.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\plugin.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.8.0_291\jre\lib\rt.jar;C:\Users\Administrator\IdeaProjects\RabbitMQ\ConsumerService\target\test-classes;C:\Users\Administrator\.m2\repository\com\rabbitmq\amqp-client\5.6.0\amqp-client-5.6.0.jar;C:\Users\Administrator\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar" RabbitMqTest
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
consumerTag amq.ctag-DEOhj99q55lb2BDUqetVaQ
exchange
deliveryTag 1
routingKey hello_rabbitmq
properties #contentHeader<basic>(content-type=null, content-encoding=null, headers=null, delivery-mode=null, priority=null, correlation-id=null, reply-to=null, expiration=null, message-id=null, timestamp=null, type=null, user-id=null, app-id=null, cluster-id=null)
body(message) hello, rabbitMq !!!!
- - - - - over - - - - -
consumerTag amq.ctag-DEOhj99q55lb2BDUqetVaQ
exchange
deliveryTag 2
routingKey hello_rabbitmq
properties #contentHeader<basic>(content-type=null, content-encoding=null, headers=null, delivery-mode=null, priority=null, correlation-id=null, reply-to=null, expiration=null, message-id=null, timestamp=null, type=null, user-id=null, app-id=null, cluster-id=null)
body(message) hello, rabbitMq !!!!
- - - - - over - - - - -
consumerTag amq.ctag-DEOhj99q55lb2BDUqetVaQ
exchange
deliveryTag 3
routingKey hello_rabbitmq
properties #contentHeader<basic>(content-type=null, content-encoding=null, headers=null, delivery-mode=null, priority=null, correlation-id=null, reply-to=null, expiration=null, message-id=null, timestamp=null, type=null, user-id=null, app-id=null, cluster-id=null)
body(message) hello, rabbitMq !!!!
- - - - - over - - - - -

可以看到连接和频道消费者和生产者的区别了

消息存储是一个先进先出的方式,RabbitMQ像是一个缓存器,能把生产者发送的信息保存起来,等待消费者接收

【RabbitMQ】01 简单模式的更多相关文章

  1. RabbitMQ的简单模式快速入门与超时异常的处理方法

    本文适合JAVA新人,想了解RabbitMQ又不想去看官网文档的人(英语水看的头疼(◎﹏◎),但建议有能力还是去看官网文档). 消息队列MQ(一) MQ全称为Message Queue,消息队列是应用 ...

  2. [RabbitMQ]01. 在 Win10 下通过 Docker 安装

    目录 win10家庭版 win10专业版和企业版 1. 开启Hyper-v 2. 安装Toolbox工具 3. 运行安装文件 4. 启动docker 5. 安装rabbitmq 6. 网页访问rabb ...

  3. RabbitMq简单模式

    RabbitMq简单模式 定义一个生产者,负责发送消息到队列中 /** * @author zjh * 生产者发信息 */ public class Producer { /** * 队列名称 */ ...

  4. 01: RabbitMQ

    目录: 1.1 RabbitMq与Redis队列对比 1.2 在win7 64位机上安装RabbitMQ 1.3 RabbitMQ消息分发轮询 与 持久化 1.4 RabbitMQ 设定某个队列里最大 ...

  5. 039 RabbitMq及数据同步01

    1.RabbitMq (1)问题引出 目前我们已经完成了商品详情和搜索系统的开发.我们思考一下,是否存在问题? 商品的原始数据保存在数据库中,增删改查都在数据库中完成. 搜索服务数据来源是索引库,如果 ...

  6. 01 . RabbitMQ简介及部署

    RabbitMQ简介 ​ MQ全称为Message Queue, 消息队列(MQ)是一种应用程序对应用程序的通信方法.应用程序通过读写出入队列的消息(针对应用程序的数据)来通信,而无需专用连接来链接它 ...

  7. 01.RabbitMQ简单使用

    官网地址:https://www.rabbitmq.com/getstarted.html RabbitMQ 优点: 数据处理异步执行: 应用之间解耦: 流量削峰 1.docker 安装 Rabbit ...

  8. RabbitMQ入门-5.6-课堂笔记-01

  9. 昨晚12点,女朋友突然问我:你会RabbitMQ吗?我竟然愣住了。

    01为什么要用消息队列? 1.1 同步调用和异步调用 在说起消息队列之前,必须要先说一下同步调用和异步调用. 同步调用:A服务去调用B服务,需要一直等着B服务,直到B服务执行完毕并把执行结果返回给A之 ...

  10. Go语言系列之RabbitMQ消息队列

    1. RabbitMQ是什么?   MQ 是什么?队列是什么,MQ 我们可以理解为消息队列,队列我们可以理解为管道.以管道的方式做消息传递. 生活场景: 1.其实我们在双11的时候,当我们凌晨大量的秒 ...

随机推荐

  1. 机器学习笔记(2): Logistic 回归

    Logistic 回归是线性回归中一个很重要的部分. Logistic 函数: \[\sigma(x) = \frac {L} {1 + \exp(-k(x - x_0))} \] 其中: \(L\) ...

  2. 关于使用Gitlab CI-CD

    关于使用 Gitlab CI/CD 如果是个人建议自己写脚本,手动运行,而不是使用 Gitlab CI/CD. 免费的 Runner 需要 Credit Card!

  3. Scrapy框架(五)--请求传参

    在某些情况下,我们爬取的数据不在同一个页面中,例如,我们爬取一个电影网站,电影的名称,评分在一级页面,而要爬取的其他电影详情在其二级子页面中. 这时我们就需要用到请求传参. 请求传参的使用场景 当我们 ...

  4. Java8统计金额demo

    Java8统计金额demo package com.example.core.mydemo.java8; public class GoodsPriceDTO { private String goo ...

  5. oppo、一加 android14 chrome116内核 input @click不触发

    // 兼容Chrome内核116及以上版本中配置disabled的input组件无法触发并冒泡click事件 .uni-input-input:disabled { pointer-events: n ...

  6. 使用嵌套的ScriptableObject及ReorderableList创建习题持久化数据

    使用嵌套的ScriptableObject及ReorderableList创建习题持久化数据 效果展示 题集持久化数据:存储题目,可以直接在inspector面板上创建对应的问题子项 问题持久化数据 ...

  7. 【ZeroMQ】zguide 第一章 部分翻译

    为了更好的阅读体验,请点击这里 本文大部分内容翻译自 Chapter 1 - Basics,原因是之前翻译的版本太老了,不得不亲自披挂上阵拿机器翻译一下.只截取了部分自己可能用得到的,所以如果有看不太 ...

  8. 深入理解Prometheus: Kubernetes环境中的监控实践

    在这篇文章中,我们深入探讨了Prometheus在Kubernetes环境中的应用,涵盖了从基础概念到实战应用的全面介绍.内容包括Prometheus的架构.数据模型.PromQL查询语言,以及在Ku ...

  9. 典型性相关分析在SPSS中的实现

    典型性相关分析是研究两组变量(每组变量中都可能有多个指标)之间相关关系的一种多元统计方法.它能够揭示出两组变量之间的内在联系. 本文着重模型在spss中的应用,通过一道例题解释各个指标的意义.详细推导 ...

  10. Windows批处理文件(.bat和.cmd)

    cmd文件和bat文件的区别 从文件描述中的区别是,cmd文件叫做:Windows命令脚本,bat文件叫:批处理文件,两者都可以使用任意一款文本编辑器进行创建.编辑和修改,只是在cmd中支持的命令要多 ...