Commit bd0e800b authored by bensinober's avatar bensinober
Browse files

DEICH-5909 koha : make rabbitmq ACK confirmation optional

parent 17c3bb5b
......@@ -11,9 +11,9 @@ our $json = JSON::MaybeXS->new(utf8 => 1);
use parent "Deichman::Main";
sub new {
my ($class) = @_;
my ($class, $args) = @_;
my $self = $class->SUPER::new();
$self->{args} = $args;
bless $self, $class;
return $self;
}
......@@ -69,15 +69,18 @@ sub openChannel {
Deichman::Exception::MQueue::ChannelFailure->throw($chan);
}
$self->{logger}->info("Opened RabbitMQ channel");
# Activate confirm
$mux = AnyEvent->condvar;
$chan->confirm(
on_success => sub { $mux->send },
on_failure => sub { $mux->send(shift) },
);
my $conf = $mux->recv;
if ($conf) {
warn Dumper("Failed activating confirm: ", $conf);
my $confirm = $self->{args}->{confirm} // 1;
if ($confirm) {
# Activate confirm
$mux = AnyEvent->condvar;
$chan->confirm(
on_success => sub { $mux->send },
on_failure => sub { $mux->send(shift) },
);
my $conf = $mux->recv;
if ($conf) {
warn Dumper("Failed activating confirm: ", $conf);
}
}
$self->{mqChan} = $chan;
return $self;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment