Пример #1
0
 /**
  * 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;
 }
Пример #2
0
 /**
  * {@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;
 }