pytho-flask-microservice
Thisisthecodeusedithisseriesofarticles:
https://medium.com/p/buildig-microservices-with-pytho-part-i-5240a8dcc2fbhttps://medium.com/@ssola/buildig-microservices-with-pytho-part-2-9f951199094a#.z48wq941ghttps://medium.com/@ssola/buildig-microservices-with-pytho-part-3-a556a4c4bc00#.y4p8rstpThisisabasicapproachofbuildigaMicroserviceotopofFlask,withsomeusefulpackageslike:
FlaskFlask-IjectorCoexioRequiremetsWearegoigtobuildamicroservicetoidexroomsiformatiocomigfromaotherservice(crawler).ThisservicewillberesposibleforidexigtheiformatioitoElasticsearch.
Theidexigwillbeaprocessof:
ValidateadsaitizethedataGetsomemetadatafromtheroomiformatiolikegeolocalizatioUploadthegiveimagesURLtoAmazoS3SedaevettoRabbitMQeverytimeaewroomhasbeeidexedserializigthepayloadwithAvro.Edpoits:
MethodURIDescriptioStatusPOST/roomitwillreceivetheroompayload,aditwillproceedtoidexitDevelopmetPATCH/room/{id}thisPATCHmethodwillallowustomakechagesotheidexeditemNotstartedDELETE/room/{id}thismethodwillremovetheroomfromtheidexNotstartedGET/room/{id}thismethodwillreturtheroomdataforagiveroomidNotstartedGET/health-checkThisedpoitretusthestateoftheserviceNotstartedRuigtheevirometYoueedtohaveDockeristallediyourmachie,afterthat,justruthiscommaddocker-composebuild&&docker-composeup-d.







评论