def __init__(s): log.info('initializing tsys route') q.connect() s.msg_mon = MessageMonitor(queue_name=s.queue_name, cb=s.msg_received) ps.subscribe(**{'route-status-publish': s.my_handler}) s.thread = ps.run_in_thread(sleep_time=0.001) #s.thread = threading.Thread(target=s.monitor_routes, args=()) #s.thread.daemon = True #s.thread.start() publish_status('online')
def __init__(s): set_up_log() log.debug('starting Gateway') s.routes = [] if debug: s.num_workers = 1 else: s.num_workers = 2 q.connect() s.thread = threading.Thread(target=s.monitor_routes, args=()) s.thread.daemon = True s.thread.start() s.workers = []
def initialize(): #do initialization read_config() # if connection with disque is not established if not q.connect(): # use redis as fallback q.switch_to_engine('redis')
def setUpClass(cls): connected = q.connect() print(connected) # this needs to be removed to a wrapper function later q.flush_all()