微服务,比如用screen隔离开,然后每个service使用不同端口通信

基础在前:https://www.cnblogs.com/adamans/articles/10532050.html

微服务下用户微服务和celery微服务的交互:
flask app.py 和celery task.py在同一目录:

先启动celery微服务:
screen -S celery_service
cd app:
celery -A app.task.celery worker -l info

再启动flask:
screen -r user_post
uwsgi --http :5002 -w app.main

cd app:
https://api5.xxx.com/user/posts/testing
post application/json
{
     "url": "http://s3.xxx.com/ba7571a95d64eaa69a49912f26816e2f.jpg"
}
{
    "code": 0,
    "data": {
        "task_id": "2ca85c18-9710-4735-aadc-26c5d7482828"
    },
    "message": "Success"
}

https://api5.xxx.com/user/posts/testing/2ca85c18-9710-4735-aadc-26c5d7482828
get
{
    "code": 0,
    "data": {
        "id": "2ca85c18-9710-4735-aadc-26c5d7482828",
        "ready": true,
        "result": [
"http://s3.xxx.com/ba7571a95d64eaa69a49912f26816e2f.jpg",
            60,
            "helloworld"
        ],
        "state": "SUCCESS",
        "status": "SUCCESS"
    },
    "message": "Success"
}

  

文件目录:

微服务下flask和celery的通信

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-01
  • 2021-08-23
  • 2021-08-15
  • 2021-11-03
  • 2021-06-15
猜你喜欢
  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
  • 2021-11-30
  • 2021-07-30
  • 2022-12-23
相关资源
相似解决方案