Reputation: 43
we used microservice architecture of jhipster and generated three applications uaa, microservice, gateway. then run uaa and jhipster registry on a server, also we have some full stack developers who want to develop both gateway and microservice at the same time.
then, they deploy their microservice and gateway on jhipsterRegistery which is located on remote server. Because of the same name of microservices, jhipsterregistery can not handle requests from gateway to the right microservice
how to manage this problem?
Upvotes: 3
Views: 637
Reputation: 88
We had the same problem and solved our issue by using a variable as a microservice application name. Then changed all rest URLs in gateway with this variable. So each developer just needs to change appname in application.yml in micro the same as the variable in app.constants.ts in the gateway as well. jhipster
Upvotes: 1
Reputation: 16284
Sharing registry and gateway is probably a bad idea. Full stack developers should run the gateway and registry locally on their PC, only share UAA if you really want to share something.
If you still want to do it, you could get inspired by how to manage multiple versions of a web API on a gateway. After all, in your case, each developer wants to use his/her own version of the API.
Here are 2 ideas that you could try:
user
) and use it to set a different application name in bootstrap-user.yml
eureka.instance.metadataMap
in bootstrap.yml
) and modify the gateway so that it uses this info for routing.Have a look at Spring Cloud Eureka server docs to get a good understanding about how this works and you could get even better ideas.
Here is an article about API versioning that could inspire you too: https://tech.asimio.net/2017/03/06/Multi-version-Service-Discovery-using-Spring-Cloud-Netflix-Eureka-and-Ribbon.html
Upvotes: 0