12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- from hub import methods, Global
- import threading
- import time
- import json
- import os
- class MessageListener(object):
- """
- """
- @classmethod
- def run(cls, background_is=True):
- from lib.UserWorkRecord import UserWorkRecord
- UserWorkRecord.init()
- from lib.MessageListenerC001 import subscribe_c001
- from lib.MessageListenerV001 import subscribe_v001
- from lib.MessageListenerZJV1 import subscribe_Veh0533
- from lib.MessageListenerZJV2 import subscribe_Veh0534
- from lib.MessageListenerZJV3 import subscribe_Veh0535
- from lib.MessageListenerZJV4 import subscribe_Veh0537
- from lib.MessageListenerZJV5 import subscribe_Veh0538
- thread_list = [
- threading.Thread(target=subscribe_c001),
- threading.Thread(target=subscribe_v001),
- threading.Thread(target=subscribe_Veh0533),
- threading.Thread(target=subscribe_Veh0534),
- threading.Thread(target=subscribe_Veh0535),
- threading.Thread(target=subscribe_Veh0537),
- threading.Thread(target=subscribe_Veh0538),
- ]
- for thread in thread_list:
- thread.setDaemon(True)
- thread.start()
- if background_is:
- return
- for thread in thread_list:
- thread.join()
- if __name__ == '__main__':
- # --- test ---
- MessageListener.run()
|