加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
run_all_microservice.py 746 Bytes
一键复制 编辑 原始数据 按行查看 历史
# nameko run UserService/service --broker amqp://admin:wxs1995.@139.199.10.230
import importlib
from pathlib import Path
root = Path(__file__).parent
def run_all():
services = {}
for f in root.iterdir():
if f.is_dir() and f.name.endswith("Service"):
name = f.name
service = importlib.import_module(name + '.service')
services[name] = service
from nameko.runners import ServiceRunner
runner = ServiceRunner(config={"AMQP_URI": "amqp://admin:wxs1995.@139.199.10.230"})
for name, service in services.items():
cls = getattr(service, name)
runner.add_service(cls)
print('wsadsa')
runner.start()
# runner.stop()
if __name__ == '__main__':
run_all()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化