Basic
basic.ack(delivery-tag delivery-tag, bit multiple)
Support: full
Acknowledge one or more messages.
Acknowledge一个或多个message
When sent by the client, this method acknowledges one or more messages delivered via the Deliver or Get-Ok methods.
When sent by server, this method acknowledges one or more messages published with the Publish method on a channel in confirm mode.
The acknowledgement can be for a single message or a set of messages up to and including a specific message.
由client发出:通过Deliver或者Get-Ok Acknowledge一个或多个message
由server发出:在confirm mode channel中通过Publish Acknowledge一个或多个message
acknowledgement可以使用在单个message、message集合或者特殊的消息中。
basic.cancel(consumer-tag consumer-tag, no-wait no-wait) -> cancel-ok
Support: full
End a queue consumer.
删除一个queue消费者
This method cancels a consumer.
This does not affect already delivered messages, but it does mean the server will not send any more messages for that consumer.
The client may receive an arbitrary number of messages in between sending the cancel method and receiving the cancel-ok reply.
It may also be sent from the server to the client in the event of the consumer being unexpectedly cancelled
(i.e. cancelled for any reason other than the server receiving the corresponding basic.cancel from the client).
This allows clients to be notified of the loss of consumers due to events such as queue deletion.
Note that as it is not a MUST for clients to accept this method from the client,
it is advisable for the broker to be able to identify those clients that are capable of accepting the method,
through some means of capability negotiation.
该方法可以删除一个消费者
这并不会影响一个已经提交的消息,但是这意味着服务器不会再为这个consumer发送任何消息
在发送cancel之后,收到cancel-ok之前,该client可能会收到任意数量的消息
在consumer被意外cancelled时,server也会向client发送这个消息
这允许使用在减少consumer时通知client,例如删除队列
需要知道的是,这并不是一个必须的
当一个broker这是一个可选的
虽然这有时意味着capability negotiation
basic.consume(short reserved-1, queue-name queue, consumer-tag consumer-tag, no-local no-local, no-ack no-ack, bit exclusive, no-wait no-wait, table arguments) ->consume-ok
Support: partial
Start a queue consumer.
设置为consumer
This method asks the server to start a "consumer", which is a transient request for messages from a specific queue.
Consumers last as long as the channel they were declared on, or until the client cancels them.
这个方法请求服务器设置自己为consumer.
consumer的生命周期最多只能跟他声明的channel一样长,除非client进行了cancel操作。
basic.deliver(consumer-tag consumer-tag, delivery-tag delivery-tag, redelivered redelivered, exchange-name exchange, shortstr routing-key)
Support: full
Notify the client of a consumer message.
向client发送consumer message
This method delivers a message to the client, via a consumer.
In the asynchronous message delivery model, the client starts a consumer using the Consume method,
then the server responds with Deliver methods as and when messages arrive for that consumer.
这个方法通过consumer发送一条message到clinet
这是一个异步操作,client使用Consume方法创建一个consumer
当message到达,server会通过Deliver方法告诉这个consumer
basic.get(short reserved-1, queue-name queue, no-ack no-ack) -> get-ok | get-empty
Support: full
Direct access to a queue.
直接访问一个queue
This method provides a direct access to the messages in a queue using a synchronous dialogue that is designed for
specific types of application where synchronous functionality is more important than performance.
这个方法提供了一个直接访问queue中的消息,是一个同步的交互,需要进行同步操作的应用程序可以使用,不过会牺牲性能。
basic.nack(delivery-tag delivery-tag, bit multiple, bit requeue)
THIS METHOD IS A RABBITMQ-SPECIFIC EXTENSION OF AMQP
这个方法是rabbitmq对AMQP的特殊扩展
Reject one or more incoming messages.
拒绝一个或多个收到的message
This method allows a client to reject one or more incoming messages.
It can be used to interrupt and cancel large incoming messages, or return untreatable messages to their original queue.
This method is also used by the server to inform publishers on channels in confirm mode of unhandled messages.
If a publisher receives this method, it probably needs to republish the offending messages.
这个方法允许client拒绝一个或多个收到的message
可以用于中断或者取消大量的message,或者返回无法处理的消息到原来的queue中
这个方法也用于server通知confirm mode的channel 的 publisher为处理的message
如果一个publisher收到这个方法,或许需要重新投递这个message
basic.publish(short reserved-1, exchange-name exchange, shortstr routing-key, bit mandatory, bit immediate)
Support: full
Publish a message.
发送一条message
This method publishes a message to a specific exchange.
The message will be routed to queues as defined by the exchange configuration and distributed to any active consumers when the transaction, if any, is committed.
这个方法投递一个message到指定的exchange中
这条message将会被 routed到指定的queue中,而这个queue是exchange配置的。
并且会被分发到任何激活的consumer中。
basic.qos(long prefetch-size, short prefetch-count, bit global) -> qos-ok
Support: partial
Specify quality of service.
指定service的属性
This method requests a specific quality of service.
The QoS can be specified for the current channel or for all channels on the connection.
The particular properties and semantics of a qos method always depend on the content class semantics.
Though the qos method could in principle apply to both peers, it is currently meaningful only for the server.
这个方法请求一个指定的service的属性
QoS可以被指定为当前channel,或者所有连接中的channels
可以设置class semantics中的内容来指定QoS的特别属性或者semantics。
虽然qos方法原则上可以适用于所有peers,当时当前只对server有意义
basic.recover(bit requeue)
Support: full
Redeliver unacknowledged messages.
重新提交未acknowledge的message
This method asks the server to redeliver all unacknowledged messages on a specified channel.
Zero or more messages may be redelivered.
This method replaces the asynchronous Recover.
这个方法请求server重新提交指定channel中未acknowledge的message
0个或者多个message可能会被重新提交。
这个方法替代了同步的Recover
basic.recover-async(bit requeue)
Redeliver unacknowledged messages.
重新提交未acknowledge的message
This method asks the server to redeliver all unacknowledged messages on a specified channel.
Zero or more messages may be redelivered.
This method is deprecated in favour of the synchronous Recover/Recover-Ok.
这个方法请求server重新提交指定channel中未acknowledge的message
0个或者多个message可能会被重新提交。
这个方法在异步Recover/Recover-Ok被弃用。
basic.reject(delivery-tag delivery-tag, bit requeue)
Support: partial
Reject an incoming message.
拒绝收到的message
This method allows a client to reject a message.
It can be used to interrupt and cancel large incoming messages, or return untreatable messages to their original queue.
这个方法允许client拒绝一个或多个收到的message
可以用于中断或者取消大量的message,或者返回无法处理的消息到原来的queue中
RabbitMQ blog post
basic.return(reply-code reply-code, reply-text reply-text, exchange-name exchange, shortstr routing-key)
Support: full
Return a failed message.
返回一条失败的message
This method returns an undeliverable message that was published with the "immediate" flag set,
or an unroutable message published with the "mandatory" flag set.
The reply code and text provide information about the reason that the message was undeliverable.
这个方法返回一个未提交成功的message,带有"immediate"标志。
或者一个为成功rounte的message,带有"mandatory"标志。
这个reply code和text提供了message未成功提交的原因。