auto execute a web service in falcon

天涯浪子 提交于 2019-12-08 04:11:48

问题


I have a function which registers my web-services to spring-eureka discovery server but it automatically de-registers it. to solve this problem, I thought to make a function which will automatically execute in few seconds and register my service again and again.

Please suggest what to do and if u have a better approach to encounter this problem that will be great.


回答1:


We can make another program which will ping the health check URL of my web server.

responsePythonAPI = requests.request("GET", "http://10.95.51.8:5050/health", headers=headers)
pythonAPI = True if responsePythonAPI.json()["status"]["value"] == u'200 OK' and responsePythonAPI.json()["status"]["code"] == 200 else False
if pythonAPI == True:
   eureka.registerWebService()
else:
   eureka.deregisterWebService()

This program will run as soon as application gets up and running and registers it in in time inteval of 100seconds



来源:https://stackoverflow.com/questions/47512483/auto-execute-a-web-service-in-falcon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!