diff --git a/swh/scheduler/updater/ghtorrent/scratch.py b/swh/scheduler/updater/ghtorrent/scratch.py deleted file mode 100644 index 4a65d7c..0000000 --- a/swh/scheduler/updater/ghtorrent/scratch.py +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright (C) 2018 The Software Heritage developers -# See the AUTHORS file at the top-level directory of this distribution -# License: GNU General Public License version 3, or any later version -# See top-level LICENSE file for more information - - -from kombu import Connection, Exchange, Queue -from pprint import pprint - - -conf = { - 'user': 'streamer', - 'pass': 'streamer', - 'port': 2765, - 'gh_torrent_exchange_name': 'ght-streams', - 'queue_name': 'swh_queue', - # http://ghtorrent.org/streaming.html : {evt|ent}.{entity|event}.action - 'routing_key': 'evt.*.insert', -} - -# works with fake event generator -# conf = { -# 'user': 'guest', -# 'pass': 'guest', -# 'port': 5672, -# 'gh_torrent_exchange_name': 'ght-streams', -# 'queue_name': 'fake-events', -# 'routing_key': 'something', - -# } - -server_url = 'amqp://%s:%s@localhost:%s//' % ( - conf['user'], conf['pass'], conf['port']) - -exchange = Exchange(conf['gh_torrent_exchange_name'], - 'topic', durable=True) -test_queue = Queue(conf['queue_name'], - exchange=exchange, - routing_key=conf['routing_key'], - auto_delete=True) - - -def process_message(body, message): - print('#### body') - pprint(body) - print('#### message') - pprint(message) - message.ack() - - -with Connection(server_url) as conn: - # produce - # producer = conn.Producer(serializer='json') - # producer.publish('hello', - # exchange=media_exchange, routing_key='test', - # declare=[test_queue]) - - # the declare above, makes sure the test queue is declared - # so that the messages can be delivered. - # It's a best practice in Kombu to have both publishers and - # consumers declare the queue. You can also declare the - # queue manually using: - # test_queue(conn).declare() - - print('Connection established') - - # consume - with conn.Consumer(test_queue, callbacks=[process_message], - auto_declare=True) as consumer: - # Process messages and handle events on all channels - while True: - conn.drain_events() diff --git a/swh/scheduler/updater/ghtorrent/test.rb b/swh/scheduler/updater/ghtorrent/test.rb deleted file mode 100755 index 7630d6f..0000000 --- a/swh/scheduler/updater/ghtorrent/test.rb +++ /dev/null @@ -1,17 +0,0 @@ -require 'bunny' - -# apt install ruby-bunny -conn = Bunny.new(:host => '127.0.0.1', :port => 2765, - :username => 'streamer', :password => 'streamer') -conn.start -ch = conn.create_channel -exchange = ch.topic('ght-streams', :durable => true) -queue_name = 'swh_queue' -q = ch.queue(queue_name, :auto_delete => true) -# q.bind(exchange, :routing_key => 'evt.*.*') -# q.bind(exchange, :routing_key => 'evt.push.insert') -q.bind(exchange, :routing_key => '*.*.*') -# q.bind(exchange, :routing_key => 'evt.create|delete|public|push.insert') -q.subscribe do |delivery_info, properties, payload| - puts "#{delivery_info.routing_key}: #{payload}" -end