def test_db(): db = RedisDb(pre='MQ')
logging.basicConfig(level=logging.DEBUG) import time from scrapy import log from scrapy.conf import settings from ec2.redis import RedisDb from ec2.scrapy.puller import ChannelsPuller from ec2.conf.enabled import ws_conf from ec2.scrapy.worker import Ctrl from ec2.utils import event log.start() db = RedisDb(pre='MQ') puller = ChannelsPuller(db, 'xxx') ctrl = Ctrl(settings, puller) url = 'http://%s/test/slow_echo/%%s_%%s' % ws_conf['client'] def test_data(): for i in xrange(200): db.queue_push('xxx', [ { 'url': url % ( i, int(time.time()), ),
import logging,sys import gevent from gevent import monkey;monkey.patch_all() from ec2.redis import RedisDb from ec2.websocket import client logging.basicConfig(level=logging.DEBUG) MQ_PREFIX = 'MQ' db = RedisDb(pre=MQ_PREFIX) #-------------------------------- def main(): url = "ws://192.168.1.230:9090/ws/chnl/test2" #url = "ws://www.ectwo.com.cn/ws/chnl/test" #ctrl = client.DumpCtrlet(url) ctrl = client.EchoCtrlet(db, 'client:echo', url) try: ctrl.start() except KeyboardInterrupt: ctrl.stop() print '\nbye' if __name__ == "__main__":