1 Star 0 Fork 0

zhzhouq9/rabbitmq-tutorials

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
receive.pl 606 Bytes
一键复制 编辑 原始数据 按行查看 历史
Colin Blower 提交于 2012-07-12 00:18 +08:00 . Improve perl tutorial files.
#!/usr/bin/perl
use strict;
use warnings;
$|++;
use AnyEvent;
use Net::RabbitFoot;
my $conn = Net::RabbitFoot->new()->load_xml_spec()->connect(
host => 'localhost',
port => 5672,
user => 'guest',
pass => 'guest',
vhost => '/',
);
my $ch = $conn->open_channel();
$ch->declare_queue(queue => 'hello');
print " [*] Waiting for messages. To exit press CTRL-C\n";
sub callback {
my $var = shift;
my $body = $var->{body}->{payload};
print " [x] Received $body\n";
}
$ch->consume(
on_consume => \&callback,
no_ack => 1,
);
# Wait forever
AnyEvent->condvar->recv;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/zhzhouq9/rabbitmq-tutorials.git
git@gitee.com:zhzhouq9/rabbitmq-tutorials.git
zhzhouq9
rabbitmq-tutorials
rabbitmq-tutorials
master

搜索帮助