Exemplo n.º 1
0
 /**
  * Send the result.
  */
 public function send()
 {
     //PS: I think this is a bit wrong. But this works, for now.
     $this->_transport->open();
     $this->_processor->process($this->_protocol, $this->_protocol);
     $this->_transport->close();
     parent::send();
 }
 /**
  * Default constructor
  *
  * @param Thrift\Transport\TTransport   $flumeTransport
  * @param ThriftFlumeEventServerClient  $client
  * @param int                           $level The minimum logging level at which this handler will be triggered
  * @param Boolean                       $bubble Whether the messages that are handled can bubble up the stack or not
  *
  * @SuppressWarnings(PMD.UnusedLocalVariable) Exception needs to be caught, but can't be used
  */
 public function __construct(Thrift\Transport\TTransport $flumeTransport, ThriftFlumeEventServerClient $client, $level = Logger::DEBUG, $bubble = true)
 {
     $this->client = $client;
     /*
      * Even if flume is away, the application should work. Thats why the exception is catched.
      */
     try {
         $flumeTransport->open();
     } catch (Thrift\Exception\TException $thriftException) {
         $this->handlingStopped = true;
     }
     parent::__construct($level, $bubble);
 }
Exemplo n.º 3
0
 /**
  * Open the transport for reading/writing
  *
  * @throws TTransportException if cannot open
  */
 public function open()
 {
     if (!$this->transport_->isOpen()) {
         $this->transport_->open();
     }
     try {
         $auth = '' . chr(0) . $this->username_ . chr(0) . $this->password_;
         $this->saslWrite_(self::METHOD, self::START);
         $this->saslWrite_($auth, self::COMPLETE);
         $saslFrame = $this->saslRead_(true);
         $this->saslComplete_ = self::COMPLETE == $saslFrame['status'];
         if (!$this->saslComplete_) {
             throw new TTransportException('Could not perform SASL auth.');
         }
     } catch (TTransportException $e) {
         throw $e;
     } catch (Exception $e) {
         throw new TTransportException('SASL Auth failed: ', $e->getMessage());
     }
     return true;
 }
Exemplo n.º 4
0
 public function open()
 {
     $this->transport_->open();
 }