Subject: | Confirm mode |
Date: | Mon, 5 May 2014 13:38:57 +0000 |
To: | bug-AnyEvent-RabbitMQ [...] rt.cpan.org |
From: | Martin Kita <makita [...] blava.net> |
Hi,
can someone post me an example how to set the confirm mode?
I can't read it from the documentation.
Many thanks.
Here is my code:
connection = Net::RabbitFoot->new()->load_xml_spec()->connect(
host => $conf->{cf}->{DST_HOST},
port => $conf->{cf}->{DST_PORT},
user => $conf->{cf}->{USER},
pass => $conf->{cf}->{PASS},
vhost => $conf->{cf}->{VHOST},
tune => {
heartbeat => $conf->{cf}->{HEARTBEAT},
channel_max => 0,
frame_max => 0
},
tls => $conf->{cf}->{SSL}
);
$channel = $connection->open_channel();
$channel->declare_exchange(
exchange => $conf->{cf}->{EXCHANGE},
passive => 1
);
$channel->{arc}->confirm(
on_ack => \&ack,
on_nack => \&nack,
on_return => \&cb,
on_inactive => \&inactive,
);
$channel->publish(
exchange => $conf->{cf}->{EXCHANGE},
header =>
Net::AMQP::Protocol::Basic::ContentHeader->new(
content_type =>
'application/json',
content_encoding => 'UTF-8',
headers => {},
delivery_mode => 1,
priority => 1,
message_id => $row->{cislo},
timestamp => time,
user_id =>
$conf->{cf}->{USER},
),
body => $message,
on_ack => \&ack,
);