c# - Consul - service detection Microservice/Domain architecture -
i'm having microservice (ms)/doamin (d) architecture each ms/d service has own rest api. have been looking using consul service detection cant figure out how use because. have followed documentation cant find how use consul in ms/d architecture ms/d has more 1 rest endpoint...
in documentation feels registrating plain "service host" not registering service endpoint "mydomain.com:8080/api// registering "mydomain.com:8080/ i.e host running service. feels have missed cant figure out how register rest-api urls using consul. i'm using consul.net (https://github.com/playfab/consuldotnet) , setup registering microservice is:
var client = getserviceclient(); var httpcheck = new agentservicecheck() { deregistercriticalserviceafter = timespan.fromminutes(1), interval = timespan.fromseconds(15), http = $"http://{host}:{microserviceport.tostring()}/healthcheck/" }; var agentreg = new agentserviceregistration() { checks = new[] { httpcheck }, address = <serviceip>, id = microserviceuniqueidentifier, name = <servicename>, port = microserviceport, };
how can register rest api endpoints 1 microservice like:
<microservice1>/api/<entity>/<api-service1> <servicename> ms1_service1 <microservice1>/api/<entity>/<api-service2> <servicename> ms1_service2 <microservice1>/api/<entity>/<api-service3> <servicename> m1s_service3
so ms/d service can ask consul me rest-endpoint ms1_service3
if cant "know how" of how service endpoint must in calling system feels wrong so... feels have missed fundamental things here.
i have been looking usin kv store rest-api-endpoints because key value can register 1 service per key value if have 10 ms of 1 kind 1 kan stored in current "key" value.
would happy if me explain best practice how use consul in combination ms/d-rest endpoints
thanks!
i suggest take @ microphone library in c#, easy configure , use.
it seems can register differents services located on same machines without problem library.
Comments
Post a Comment