Change API for the message callback return code:

* undef => mark as done (send FIN);
* -1 and above, send requeue, with value specifying
  the delay:
  * >= 0 => use value as delay, 0 is a special case, means immediatly;
  * -1 => use number of attempts times the requeue_delay constructor
    parameter.

Signed-off-by: Pedro Melo <melo@simplicidade.org>
This commit is contained in:
Pedro Melo
2014-07-20 17:32:50 +01:00
parent 3579cc1a48
commit dcca4aea33

View File

@@ -96,9 +96,9 @@ sub _start_nsqd_connection {
my $action = $self->{message_cb}->($self, $msg);
## Action below -1 does nothing, we assume the user took care of it himself
if (not defined $action) { $conn->mark_as_done_msg($_[1]) }
elsif ($action >= 0) { $conn->requeue_msg($_[1], $action) }
else { $conn->touch_msg($_[1], -$action) }
elsif ($action >= -1) { $conn->requeue_msg($_[1], $action) }
}
);