Where did the message that could not be routed go?
Without any settings, messages that cannot be routed are simply discarded.
Failure to route: The Routing key is incorrect.
Solution:
(1) Use mandatory=true in conjunction with ReturnListener to implement message postback.
(2) When declaring an exchange, specify the alternate exchange.
How are messages distributed when multiple consumers are listening to a queue?
(1) Round-Robin
The default policy, consumers receive messages in turn and evenly.
(2) Fair dispatch
If you want to distribute messages based on the consumer's processing capabilities and send more messages to idle consumers, you can use basicQos(int prefetch_count) to set it up. prefetch_count: when a consumer has multiple messages that do not respond with Ack, no more messages will be sent to this consumer.
When does a message become the dead Letter?
(1) Message rejected and no re-queue set: (NACK || Reject ) && requeue == false
(2) Message expired (TTL setting of message or queue)
(3) Message accumulated, the queue reaches the maximum length, first-in-queue message programming DL
Solution: You can specify a Dead Letter Exchange when declaring a queue to implement Dead Letter forwarding and ensure that messages are not lost.
How do I persist messages?
Persistence is a process in which RabbitMQ solidifies data in memory (such as exchanges, queues, and messages) to disk to prevent data loss when abnormal conditions occur.
Persistence Classification | Description |
Exchange Persistence | Set the durable parameter when creating exchange. channel.exchangeDeclare(EXCHANGE_NAME, "direct", true); |
Queue Persistence | Also set the durable parameter. The persistent queue will be saved to disk, ensuring that relevant information will not be lost when the server is restarted. channel.queueDeclare(QUEUE_NAME, true, false, false, null); |
Message Persistence | Even if exchange and queue persistence are not lost due to restart, messages stored in the queue will still be lost. The solution is to set the message delivery mode to 2, which represents persistence (JAVA). In theory, all messages can be set to be persistent, but this will seriously affect RabbitMQ performance as the speed of writing to disk can be much slower than writing to memory. Therefore, when choosing whether to persist messages, there is a trade-off between reliability and throughput. |
Does RabbitMQ exclusive instance support Internet access?
Yes.
When creating RabbitMQ exclusive instance, under the More option, select to enable Internet Access to automatically control Internet access, and select purchased Elastic IP address and bandwidth. Or, after creation, turn on the Internet Access switch on the instance details page.
Does RabbitMQ instance support cross-VPC and cross-subnet access?
Yes, you can create a VPC peering connection to connect two VPC networks for access cross-VPC.
Failed to connect to RabbitMQ instance using SSL?
First, check whether port 5671 (SSL access) or 5672 (non-SSL access) is allowed for the inbound direction rule of the security group.
Second, configure SSL one-way authentication by referring to the following:
ConnectionFactory factory = new ConnectionFactory();
factory.setHost(host);
factory.setPort(port);
factory.setUsername(user);
factory.setPassword(password);
factory.useSslProtocol();
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
Can the client access the RabbitMQ instance via DNAT?
Yes.
Why does the RabbitMQ cluster only have one connection address?
The connection address of the RabbitMQ cluster instance is actually the LVS node address (load balancing address) of the instance. When the client connects to the instance, the client request is distributed to each node of the cluster instance through the load balancer.
Are there backups for the queues of the RabbitMQ instance cluster?
RabbitMQ instance enables mirror queue by default and will back up copies of the queue on multiple agents in the cluster. When a broker fails, the cluster will select a broker from other normal agents to synchronize queue data.
Does RabbitMQ support two-way authentication?
No.
Does RabbitMQ instance support expansion?
No.
Does RabbitMQ instance support modifying availability zone?
No, you can purchase a new instance to meet the requirements of the availability zone.
Cause analysis of RabbitMQ client connection error
RabbitMQ client connection fails, possibly due to incorrect address, port, username or password.
Incorrect connection address
Exception in thread "main" java.net.SocketTimeoutException: connect timed out at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
Incorrect port
Exception in thread "main" java.net.ConnectException: Connection refused (Connection refused) at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
Incorrect username or password
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:351) at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:64)
Does RabbitMQ instance support different subnets?
Yes.
If the client and the instance are in the same VPC, cross-subnet access is supported. By default, subnets in the same VPC can communicate with each other.
When the client and instance are in different VPCs, a VPC peering connection needs to be established.
Can a client connect to multiple Vhosts under the same RabbitMQ?
Yes.
Vhost (Virtual Host) is the basic feature of RabbitMQ, each Vhost is equivalent to an independent virtual message server, each Vhost data directory is different, with its own queues, exchanges and permission control mechanisms. In terms of performance, there is not much difference between connecting multiple Vhosts and using a single Vhost.
Where do I set the message creation time?
The message creation time is set by the production client when the message is produced.
Does RabbitMQ support cross-region deployment?
No.
How do I clear queue data?
(1) Enter the DMS RabbitMQ control center;
(2) Click the corresponding RabbitMQ instance on the Instance List page;
(3) Click the queue you want to clear on the Queue Management page;
(4) Click Clear Queue on the Clear Message page.
Does RabbitMQ support upgrading CPU and memory?
RabbitMQ supports expansion specifications.
How do I set up Message ID?
To track and identify messages, you can set the Message ID property on the producer client of the DMS RabbitMQ to set up a unique identifier for each message.
Set the messageid property of Basic.Properties on the producer client of the DMS RabbitMQ. The sample code is as follows:
AMQP.BasicProperties props = new AMQP.BasicProperties.Builder().messageId("messageid").build();
channel.basicPublish("ExchangeName", "RoutingKey", true, props, ("MessageSendingBody").getBytes());Message ID is an optional property of the message, with the type of String. Message ID is usually set to be unique in business and is suitable for tracking and identifying sales orders, work orders, and other scenarios where messages need to be unique. The DMS RabbitMQ server does not perform idempotent processing on messages. If you want to implement message idempotency, that is, if a message is retried multiple times, the result of the consumer consuming the repeated message multiple times is the same as consuming it once, and the multiple consumption does not cause side effects to the system. On the basis of setting a unique message ID for each message, you also need to perform idempotent processing on the messages in the consumer client of the DMS RabbitMQ.
What version does RabbitMQ use?
The server-side RabbitMQ versions include 3.8.9 and 3.8.35.
What is the protocol version number of the SSL connection for the RabbitMQ instance?
The server supports protocol version numbers: SSL v3, TLS v1, TLS v1.1, TLS v1.2, TLS v1.3.