/**
  * First of all test if the validator do not throws exception if the message is ok
  */
 public function testValidate()
 {
     try {
         MessageValidator::validate($this->message);
     } catch (\Exception $e) {
         $this->fail('Validation throws Error on a valid message.');
     }
 }
 /**
  * Sends message if it's valid. Return false on failure
  * 
  * @param MessageInterface $message
  * 
  * @return bool
  */
 protected function sendMessage(MessageInterface $message)
 {
     try {
         MessageValidator::validate($message);
         $this->queue->sendmulti([$this->application . '-' . $this->environment, 'logs.' . $this->application . '.' . $this->environment, json_encode($message)]);
         $sent = true;
     } catch (ZMQSocketException $exception) {
         // we cannot connect, make sure application does not exit
         $this->addDispatchException($exception);
         $sent = false;
     } catch (LogjamDispatcherException $e) {
         $this->addDispatchException($e);
         $sent = false;
     }
     return $sent;
 }