/** * Writes the record down to the log of the implementing handler * * @param array $record * * @return void */ protected function write(array $record) { $content = $record['formatted']; $content['StreamName'] = $this->streamName; try { /** @noinspection PhpUndefinedMethodInspection */ $this->kinesisClient->putRecord($content); } catch (\Exception $ex) { // We intentionally eat exceptions here -- the purpose of this handler is to emit logs to Kinesis for // real-time monitoring, not to guarantee delivery of mission critical logs. If Kinesis cannot accept // the log at this time, we just drop it on the floor and move on. // @TODO: A more durable (but slower) approach to exception handling would be a nice future option } }
/** * Publishes the message and does nothing with the properties * * @param string $msgBody * @param string $routingKey * @param array $additionalProperties */ public function publish($msgBody, $routingKey = '', $additionalProperties = array()) { $result = $this->client->putRecord(array_merge(array('StreamName' => $this->streamName, 'Data' => $msgBody, 'PartitionKey' => $routingKey), $this->getClientParams())); }