tencent cloud

RabbitMQ Client API Description
Last updated:2026-01-04 15:02:28
RabbitMQ Client API Description
Last updated: 2026-01-04 15:02:28
This document introduces the core APIs supported by the RabbitMQ client and their features in detail, covering key operations such as message production and consumption, exchange/queue management, flow control, and reliability assurance. It serves as a quick reference and integration guide for developers to help you efficiently use RabbitMQ for message queue development.

Message Production and Consumption

API
Feature Description
basicPublish
Sends messages to a specified exchange. It supports configuring the Routing Key and message properties.
basicConsume
Subscribes to a queue in push mode. The server actively pushes messages to consumers.
basicGet
Pulls a single message actively from the queue in pull mode (suitable for low-frequency consumption scenarios).
basicAck
Manually acknowledges successful message processing (ensuring message reliability).
basicNack
Rejects messages in batches. It supports the requeue parameter to control whether to redeliver messages.
basicReject
Rejects a single message (the feature is similar to basicNack, but only for a single message).
basicCancel
Cancels consumer subscriptions and terminates message pushes.
basicRecover
Requeues unacknowledged messages (with an option to redeliver them).

Exchange Management

API
Feature Description
exchangeDeclare
Declares and creates an exchange with configurable properties such as the type (such as direct/fanout) and persistence.
exchangeDeclarePassive
Checks whether the specified exchange exists, and throws an exception if it does not exist (for verification).
exchangeDeclareNoWait
Declares an exchange asynchronously with no return value (suitable for high-performance scenarios and requires manual error handling).
exchangeDelete
Deletes the specified exchange (only effective when it has no binding relationships).
exchangeBind
Binds two exchanges to implement message routing and forwarding (such as log distribution scenarios).
exchangeUnbind
Unbinds the binding relationship between exchanges.
exchangeDeleteNoWait
Deletes an exchange asynchronously without returning the operation result.
exchangeBindNoWait
Declares a binding relationship between exchanges and creates one asynchronously if it does not exist.
exchangeUnbindNoWait
Unbinds an exchange asynchronously with no return value.

Queue Management

API
Feature Description
queueDeclare
Declares and creates a queue with configurable properties such as persistence and exclusivity.
queueDeclarePassive
Checks whether the specified queue exists, and throws an exception if it does not exist.
queueBind
Binds a queue to an exchange and specifies the routing rules (Routing Key).
queueUnbind
Unbinds the binding relationship between a queue and an exchange.
queuePurge
Purges all messages in the specified queue (proceed with caution, as purged data cannot be recovered).
queueDelete
Deletes the specified queue (only effective when it has no consumers).
queueDeclareNoWait
Declares a queue and creates one asynchronously if it does not exist.
queueDeleteNoWait
Deletes a queue asynchronously without returning the operation result.
queueBindNoWait
Declares a binding relationship between a queue and an exchange and binds one asynchronously if it does not exist.

Traffic Control and Reliability

API
Feature Description
basicQos
Limits the maximum number of unacknowledged messages for a consumer on a specific channel or connection (to achieve fair distribution or traffic control).
txSelect
Sets the current channel to transaction mode to enable a transaction.
confirmSelect
Enable the Publisher Confirm mode (a high-performance alternative scheme for asynchronously confirming message delivery to the broker).
txCommit
Commits a transaction and confirms all uncommitted operations (such as message publishing and acknowledgment) on the current channel.
txRollback
Rolls back a transaction and undoes uncommitted operations on the current channel (messages will be requeued).
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback