标签归档:RabbitMQ
RabbitMQ的消息未确认和多次确认问题
php+RabbitMQ 3.8.16+简单延时队列实现
Consumer Acknowledgements and Publisher Confirms
过滤以不显示amq.gen-xxx队列,刷新会保留过滤
过滤以不显示amq.gen-xxx队列,刷新会保留过滤
^(?!amq\.gen\-).*$

Broken pipe or closed connection
RabbitMQ 简单队列
我想要的是定时任务延时队列,似乎不满足需求,现在用redis做的队列又可以满足大部分需求,先放着吧
# 推送到队列
public function aa032() {
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
$channel = $connection->channel();
$channel->queue_declare('hello', false, false, false, false);
$msg = new AMQPMessage('Hello World 233!');
$channel->basic_publish($msg, '', 'hello');
echo " [x] Sent 'Hello World 233!'\n";
$channel->close();
$connection->close();
}
# 守护处理队列
public function aa033() {
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
$channel = $connection->channel();
$channel->queue_declare('hello', false, false, false, false);
echo " [*] Waiting for messages. To exit press CTRL+C\n";
$callback = function ($msg) {
echo ' [x] Received ', $msg->body, "\n";
};
$channel->basic_consume('hello', '', false, true, false, false, $callback);
while (count($channel->callbacks)) {
$channel->wait();
}
}