美文网首页
RabbitMQ 入门学习笔记

RabbitMQ 入门学习笔记

作者: X4tar | 来源:发表于2020-02-08 21:37 被阅读0次

RabbitMQ入门教程笔记

入门教程为官方英文教程

1. Exchange 同名创建不会报错

如下过次创建同名Exchange,不会发生错误。但也不会创建多个同名Exchange,说明RabbitMQ进行创建前检查并包容了错误。 发现这点是因为教程中在EmitLog.java 和 ReceiveLogs.java 中都调用了 channel.exchangeDeclare(EXCHANGE_NAME,"fanout");

try (Connection connection = factory.newConnection();
            Channel channel = connection.createChannel()){
            channel.exchangeDeclare(EXCHANGE_NAME,"fanout");
            channel.exchangeDeclare(EXCHANGE_NAME,"fanout");
            channel.exchangeDeclare(EXCHANGE_NAME,"fanout");
            channel.exchangeDeclare(EXCHANGE_NAME,"fanout");
            String message = "Hello World using Fanout Exchange";

            channel.basicPublish(EXCHANGE_NAME,"",null,message.getBytes("UTF-8"));
            System.out.println(" [x] Sent '" + message + "'");
        }

2. RabbitMQ 中的 exclusive 是指什么意思

In general doing RPC over RabbitMQ is easy. A client sends a request message and a server replies with a response message. In order to receive a response we need to send a 'callback' queue address with the request. We can use the default queue (which is exclusive in the Java client). --RabitMQ RPC

比如这句话中exclusive是指每次只有一个java client可以使用嘛

相关文章

网友评论

      本文标题:RabbitMQ 入门学习笔记

      本文链接:https://www.haomeiwen.com/subject/jtjwxhtx.html