This document mainly introduces common terms and their explanations used in TDMQ for RabbitMQ.
Binding
In TDMQ for RabbitMQ, exchanges are associated with queues through bindings. This way, TDMQ for RabbitMQ can correctly route messages to the specified queue.
Binding key
When an exchange is bound to a queue, a Binding Key is usually specified. When a producer sends a message to the exchange, a Routing Key is usually specified. If the Binding Key matches the Routing Key, the message will be routed to the corresponding queue.
When multiple queues are bound to the same exchange, the same Binding Key can be used.
The Binding Key is not effective in all situations; it depends on the exchange type. For example, a fanout exchange ignores the Binding Key and routes messages to all queues that are bound to it.
Channel
Multiple channels can be established within each physical TCP connection on the client side, with each channel representing a session task.
Connection
A TCP connection, which is a physical TCP connection between producers or consumers and TDMQ for RabbitMQ.
Exchange
Producers send a message to an exchange, which then routes the message to one or more queues (or discards it). Exchanges route messages based on the message properties or content.
Exchange Types
TDMQ for RabbitMQ supports several common exchange types: fanout, direct, topic, and header.
Fanout: A fanout exchange routes all messages sent to it to all queues bound to it.
Direct: A direct exchange routes messages to queues where the Routing Key exactly matches the Binding Key.
Topic: This type of exchange is similar to the direct exchange; a topic exchange supports multi-condition matching and fuzzy matching. It routes messages to the queues bound to it by using the Routing Key pattern matching and string comparison methods.
Header: A header exchange is irrelevant to the Routing Key, and its matching mechanism relies on the Headers properties of messages. When you bind a queue to a header exchange, you need to declare a map of key-value pairs to implement the binding. When a message is sent to the RabbitMQ cluster, the Headers of the message will be retrieved and matched against the key-value pairs specified during the binding of the queue and the exchange. If they match exactly, the message is routed to the queue; otherwise, it is not.
Message acknowledgment
Message acknowledgment: After consuming a message, the consumer sends an acknowledgment to TDMQ for RabbitMQ. TDMQ for RabbitMQ only deletes the message from the queue after receiving this acknowledgment. If TDMQ for RabbitMQ does not receive the acknowledgment and detects that the consumer's RabbitMQ connection is interrupted, it will resend the message to another consumer for processing.
Message durability
Message persistence: Message persistence ensures that messages are not lost even if the TDMQ for RabbitMQ service restarts. Both the queue and message can be set to durable, which ensures that RabbitMQ messages will not be lost in most cases.
Prefetch count
When consumers have message acknowledgment enabled, they can asynchronously acknowledge messages based on their business needs. The prefetch setting limits the maximum number of unacknowledged messages that can be sent to a consumer. For example, if prefetchCount=10 is set, the queue will send 10 messages to each consumer (assuming there are 2 consumers, A and B). The consumers do not need to respond immediately and can cache the 10 messages locally. Once a consumer processes and acknowledges a message, the queue will send another message to that consumer. If neither consumer acknowledges any message, the queue will not continue sending new messages.
Queue
A queue in TDMQ for RabbitMQ is an internal object used for storing messages. Each message will be placed into one or multiple queues.
Routing key
When a producer sends a message to an exchange, it typically specifies a Routing Key that determines the routing rules. The Routing Key takes effect in combination with the exchange type and the Binding Key.
In typical use, where the exchange type and Binding Key are fixed, the producer can determine the destination of the message by specifying the Routing Key when sending the message to the exchange.
Vhost
A virtual host (vhost) is used for logical isolation, which enables the separate management of individual exchanges, queues, and bindings. This ensures that applications run securely on different vhost instances without interfering with each other. A single instance can have multiple vhosts, and each vhost can contain several exchanges and queues. When connecting to TDMQ for RabbitMQ, producers and consumers need to specify a vhost.
User
A user is the smallest unit for permission management within a TDMQ for RabbitMQ cluster. By configuring permissions for users, you can grant them configuration and read/write permissions across different vhosts.
Each user can set a password. Users can add a username and password in a client to access TDMQ for RabbitMQ clusters for message production and consumption.
Permissions can be assigned to individual users. They define a user's permissions within a specific vhost, including configuration and read/write operations on exchanges and queues. Configuration permissions control the ability to declare or delete exchanges and queues, while read/write permissions govern operations such as reading messages from queues, sending messages to exchanges, and binding exchanges and queues.