Beispiel #1
0
 public function onMessageReceived(MessageReceivedEvent $event)
 {
     /// @todo this might give php warnings
     ///       We could also check if Symfony\Component\VarDumper is available and use it instead...
     if (class_exists('Doctrine\\Common\\Util\\Debug')) {
         echo "Received a message at " . strftime('%Y/%m/%d - %H:%M:%S', time()) . ": " . \Doctrine\Common\Util\Debug::dump($event->getMessage(), 2, false, false) . "\n";
     } else {
         echo "Received a message at " . strftime('%Y/%m/%d - %H:%M:%S', time()) . ": " . var_export($event->getMessage(), true) . "\n";
     }
 }
 public function onMessageReceived(MessageReceivedEvent $event)
 {
     // filter out unwanted events
     if (!$event->getConsumer() instanceof \Kaliop\QueueingBundle\Service\MessageConsumer\ConsoleCommand) {
         return;
     }
     $body = $event->getBody();
     $command = @$body['command'];
     if (empty($command)) {
         /// we leave it up to the consumer to respond to these messages...
         return;
     }
     if (!$this->isCommandAllowed($command)) {
         $event->stopPropagation();
     }
 }
 public function onMessageReceived(MessageReceivedEvent $event)
 {
     // filter out unwanted events
     if (!$event->getConsumer() instanceof \Kaliop\QueueingBundle\Service\MessageConsumer\SymfonyService) {
         return;
     }
     $body = $event->getBody();
     $service = @$body['service'];
     $method = @$body['method'];
     if (empty($service) || empty($method)) {
         /// we leave it up to the consumer to respond to these messages...
         return;
     }
     if (!$this->isServiceAllowed($service, $method)) {
         $event->stopPropagation();
     }
 }
 public function onMessageReceived(MessageReceivedEvent $event)
 {
     // filter out unwanted events
     if (!$event->getConsumer() instanceof \Kaliop\QueueingBundle\Service\MessageConsumer\HTTPRequest) {
         return;
     }
     $body = $event->getBody();
     $url = @$body['url'];
     $options = @$body['options'];
     if (empty($options)) {
         /// we leave it up to the consumer to respond to these messages...
         return;
     }
     if (!$this->isServiceAllowed($url, $options)) {
         $event->stopPropagation();
     }
 }