NAME
AnyEvent::RabbitMQ::PubSub::Consumer - rabbitmq consumer
METHODS
init()
set prefetch_count
declare exchange and queue
consume($cv, $on_consume)
run consume $on_consume
code on channel
return Promise
my $cv = AnyEvent->condvar();
$self->consume(
$cv,
sub {
my ($consumer, $msg) = @_;
...
}
)->then(sub {
say 'Consumer was started...';
});
reject_and_republish($msg)
reject (drop) message
and after 10ms (to avoid 100% CPU)
republish message back (to end of queue)
reject($msg)
reject (drop) message
ack($msg)
ack $msg
same as
$consumer->channel->ack(delivery_tag => $msg->{deliver}{method_frame}{delivery_tag});