repository)) { throw new ExecutionFailureException('Dataset does not have a repository'); } if (!isset($input->repository->full_name)) { throw new ExecutionFailureException('Dataset repository does not have a name'); } $name = strtolower($input->repository->full_name); $eventtype = event_type(); $connection = retry_rabbitmq_conn(); $channel = $connection->channel(); $dec = $channel->exchange_declare( 'github-events', 'topic', false, // passive true, // durable false // auto_delete ); $channel->queue_declare( 'github-events-unknown', false, // passive true, // durable false, // exclusive false // auto-delete ); $channel->queue_bind( 'github-events-unknown', 'github-events', 'unknown.*' ); $message = new AMQPMessage(json_encode($input), array( 'content_type' => 'application/json', 'delivery_mode' => AMQPMessage::DELIVERY_MODE_PERSISTENT, )); $routing_key = "$eventtype.$name"; $rec = $channel->basic_publish($message, 'github-events', $routing_key); echo "ok"; } catch (DumpableException $e) { trigger_error(print_r($e, true), E_USER_WARNING); header("HTTP/1.1 400 Eh", true, 400); var_dump($e); echo ob_get_clean(); } catch (\Exception $e) { trigger_error(print_r($e, true), E_USER_WARNING); header("HTTP/1.1 400 Meh", true, 400); var_dump(get_class($e)); echo ob_get_clean(); }