Пример #1
0
	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')
Пример #2
0
	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 = []
Пример #3
0
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')
Пример #4
0
 def setUpClass(cls):
     connected = q.connect()
     print(connected)
     # this needs to be removed to a wrapper function later
     q.flush_all()