简体   繁体   中英

uWSGI: Using emperor mode, register internal routing rules for vassals

I am using uWSGI to deploy python wsgi microservices.

My architecture looks like :

  • Emperor => handles routing of all request starting by /api
  • Vassal "users" => handles request on /api/users
  • Vassal "payments" => handles request on /api/payments
  • etc.

The routing is handled by the emperor using internal routing rules.

My problem is that routing rules are statically defined in the emperor configuration file.

1/ Is there any way for a vassal to "dynamically" (= on startup) add rules to the emperor internal routing table ?

2/ If not, is there any way for an emperor to "get" routing rules from the vassal when starting it ?

Emperor's purpose is managing processes (vassals), the 'routing' concept is the job of 'corerouters' (fastrouter, httprouter, sslrouter, rawrouter). For your case the subscription system could be the best solution:

http://uwsgi-docs.readthedocs.org/en/latest/SubscriptionServer.html

in 2.1 (current github master) there is the possibility to subscribe 'by mountpoint'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM