getQueue() public method

public getQueue ( string $vhost, string $name, integer $interval = 30 ) : array
$vhost string
$name string
$interval integer
return array
示例#1
0
 /**
  * {@inheritdoc}
  */
 public function collect()
 {
     $queue = $this->rabbitMqClient->getQueue($this->vhost, $this->queueName);
     $metrics = [new Metric('pending', $queue['messages_ready']), new Metric('running', $queue['messages_unacknowledged'])];
     if (array_key_exists('message_stats', $queue)) {
         $metrics[] = new Metric('publish_rate', $queue['message_stats']['publish_details']['rate']);
         $metrics[] = new Metric('deliver_rate', $queue['message_stats']['deliver_get_details']['rate']);
     }
     return $metrics;
 }
示例#2
0
 function it_collects_the_rates_from_stats_if_available(RabbitMqHttpClient $client)
 {
     $client->getQueue('vhost', 'queue')->willReturn(['messages_ready' => 1, 'messages_unacknowledged' => 10, 'message_stats' => ['publish_details' => ['rate' => 0.12], 'deliver_get_details' => ['rate' => 12.34]]]);
     $this->collect()->shouldBeLike([new Metric('pending', 1), new Metric('running', 10), new Metric('publish_rate', 0.12), new Metric('deliver_rate', 12.34)]);
 }