Exemplo n.º 1
0
 public function execute(AMQPMessage $message)
 {
     $logger = $this->logger;
     $redis = $this->redis;
     $body = json_decode($message->body, true);
     if (!array_key_exists('BUILD_ID', $body['env'])) {
         $logger->warn('no build information', ['container' => $body['container'], 'message' => $body]);
         return true;
     }
     $buildId = $body['env']['BUILD_ID'];
     $logger->debug('processing log fragment', ['build' => $buildId, 'container' => isset($body['container']) ? $body['container'] : null, 'keys' => array_keys($body)]);
     $build = new Build();
     $build->setId($buildId);
     $redis->rpush($build->getLogsList(), json_encode(['type' => Build::LOG_OUTPUT, 'message' => $body['content'], 'stream' => $this->getStreamType($body['type']), 'microtime' => $body['timestamp'], 'fragment_id' => $body['fragment_id'], 'build_id' => $buildId]));
 }