/** * Test if should requeue and with what delay * * The message will contain how many attempts had been made _before_ we * made our attempt (which must have failed). * * @param MessageInterface $msg * * @return integer|NULL The number of milliseconds to delay for, if we * want to retry, or NULL to drop it on the floor */ public function shouldRequeue(MessageInterface $msg) { $attempts = $msg->getAttempts(); return $attempts < $this->maxAttempts ? $this->delay : NULL; }
/** * {@inheritDoc} */ public function shouldRequeue(MessageInterface $msg) { $attempts = $msg->getAttempts(); $delay = isset($this->delays[$attempts - 1]) ? $this->delays[$attempts - 1] : $this->delays[count($this->delays) - 1]; return $attempts < $this->maxAttempts ? $delay : NULL; }