Invoking microservices through Zuul

Let's invoke random service through the service proxy now. The direct URL to a random microservice is http://localhost:8080/random. This is exposed by Microservice A, whose application name is microservice-a.

The URL structure to call a service through Zuul API Gateway is http://localhost:{port}/{microservice-application-name}/{service-uri}. So, the Zuul API Gateway URL for random service is http://localhost:8765/microservice-a/random. When you invoke random service through API Gateway, you get a response shown here. The response is similar to what you would typically get when directly calling the random service:

    [73,671,339,354,211]

The following is an extract from the Zuul Api Gateway log. You can see ...

Get Mastering Spring 5.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.