protected function throttle($maxMessageRate)
  {

    $this->throttleMessageCount++;

    // Reset the number of processed message by each second
    if ($this->throttleSecondStamp != date('s')) {
      $this->throttleSecondStamp = date('s');
      $this->throttleMessageCount = 0;
    }

    // Trigger processing delay when max message rate is exceeded
    if ($this->throttleMessageCount > $maxMessageRate) {
      sleep(MBC_BaseConsumer::THROTTLE_TIMEOUT);

      echo '- Trottling activated, message rate: ' . $this->throttleMessageCount . '. Waiting for ' .
        MBC_BaseConsumer::THROTTLE_TIMEOUT . ' seconds.', PHP_EOL;
      $this->statHat->ezCount('MB_Toolbox: MB_Toolbox_BaseConsumer: throttle', 1);
      $this->throttleMessageCount = 0;
    }
  }
protected function throttle($maxMessageRate)
  {

    $this->throttleMessageCount++;

    // Reset the number of processed message by each second
    if ($this->throttleSecondStamp != date('s')) {
      $this->throttleSecondStamp = date('s');
      $this->throttleMessageCount = 0;
    }

    // Trigger processing delay when max message rate is exceeded
    if ($this->throttleMessageCount > $maxMessageRate) {
      sleep(MBC_BaseConsumer::THROTTLE_TIMEOUT);

      echo '- Trottling activated, message rate: ' . $this->throttleMessageCount . '. Waiting for ' .
        MBC_BaseConsumer::THROTTLE_TIMEOUT . ' seconds.', PHP_EOL;
      $this->statHat->ezCount('MB_Toolbox: MB_Toolbox_BaseConsumer: throttle', 1);
      $this->throttleMessageCount = 0;
    }
  }
protected function throttle ( $ maxMessageRate ) { $ this -> throttleMessageCount ++ ; // Reset the number of processed message by each second if ( $ this -> throttleSecondStamp != date ( 's' ) ) { $ this -> throttleSecondStamp = date ( 's' ) ; $ this -> throttleMessageCount = 0 ; } // Trigger processing delay when max message rate is exceeded if ( $ this -> throttleMessageCount > $ maxMessageRate ) { sleep ( MBC_BaseConsumer :: THROTTLE_TIMEOUT ) ; echo '- Trottling activated, message rate: ' . $ this -> throttleMessageCount . '. Waiting for ' . MBC_BaseConsumer :: THROTTLE_TIMEOUT . ' seconds.' , PHP_EOL ; $ this -> statHat -> ezCount ( 'MB_Toolbox: MB_Toolbox_BaseConsumer: throttle' , 1 ) ; $ this -> throttleMessageCount = 0 ; } }
Throddle the rate the consumer processes messages.

@param integer $maxMessageRate
The number of messages to process per second before triggering a "pause". Higher values allow for greater
processing velosity / messages per second.

@return null
Throddle the rate the consumer processes messages .