1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- from hub import methods, Global
- import threading
- import time
- import json
- import os
- # --- for linux
- # save_dir = f"/home/server/logs"
- # --- for windows
- # save_dir = r'C:\SRI-DINO.Server-py\logs' # sri内网测试环境
- save_dir = r'C:\logs' # sri内网测试环境
- 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()
|