I have a monolith application A, which needs to invoke a microservice B via service discovery . Consul is the service discovery server used. Microservice B is registered with the Consul server.
From A i am able to invoke B by giving http://hostname:portname/endpoint
How to do this via service discovery.
I tried adding the dependency spring-cloud-dependencies in Monolith Application A so that i can use org.springframework.cloud.client.discovery.DiscoveryClient to do the service discovery, but this spring dependency is bringing in embedded tomcat jar which is clashing with my jboss as both run on the default port of 8080 . converting monolith A into a springboot app just for the sake of service discovery isnt an option.
Is there a non spring option to do service discovery from a monolith application to a Consul server?
I managed to lookup the consul server from monolith application. Add a dependency in your pom.xml
The below method will return the hostname,port like
http://hostname:porton which the services are running and as registered on consul