Skip to content

Commit

Permalink
Add ignore error in commit messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitor Ruschoni committed Jun 24, 2019
1 parent 61ce596 commit 4d3594c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Consumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,22 @@ private function commit(\RdKafka\Message $message, bool $success): void
try {
if (!$success && !is_null($this->config->getDlq())) {
$this->sendToDql($message);
$this->consumer->commit();
$this->commits = 0;
$this->consumer->commit();
return;
}

$this->commits++;
if ($this->isMaxMessage() || $this->commits >= $this->config->getCommit()) {
$this->consumer->commit();
$this->commits = 0;
$this->consumer->commit();
return;
}
} catch (\Throwable $throwable) {
$this->logger->error($message, $throwable, 'MESSAGE_COMMIT');
throw $throwable;
if ($throwable->getCode() != RD_KAFKA_RESP_ERR__NO_OFFSET){
throw $throwable;
}
}
}

Expand Down

0 comments on commit 4d3594c

Please sign in to comment.