0

The scenario looks like that:

  • eureka server and two other services (spring-boot-apps) are running
  • two micro services (A and B) are registered in eureka server
  • both services provides REST HATEOAS endpoint
  • app 'A' provides a service method 'x' which response message should contains a link to a remote REST endpoint 'y' from a service 'B'

My idea was to use: DynamicServiceInstanceProvider and Traverson to finally get a Link object.

DynamicServiceInstanceProvider provider = new DynamicServiceInstanceProvider(discoveryClient, "B");
Traverson traverson = new Traverson(provider.getUri(), MediaTypes.HAL_JSON);
Link link = traverson.follow("y").asTemplatedLink();

Unfortunately it doesn't work at all :/ What I'm doing wrong? Is there a better way to obtain a link to a remote endpoint?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Karol Król
  • 3,320
  • 1
  • 34
  • 37
  • "doesn't work at all' isn't really helpful. What happens? What versions are you using? What is your configuration? Have you verified that "B" is registered in eureka? Please provide more information. – spencergibb Jun 26 '17 at 17:30
  • @spencergibb As I described "two microservices are registered in eureka", so B is registered :) In short. I don't understand how to use Traverson correctly. In my sandbox project I stoped using it -> https://github.com/kjkrol/kotlin4fun-eshop-app In this case I would like to create a Link to a remote REST method (and I did it, but without Tracerson). – Karol Król Jun 26 '17 at 22:45

0 Answers0