Register two Java web applications with Spring Registry

156 Views Asked by At

I want to register two sample Java web applications with Spring Registry so that both applications can communicate directly. I don't know much about programming.

Here I found the Spring Registry code, where Spring backend application is registering itself when it is deployed on Cloud Foundry, so that any Spring frontend application that is trying to reach the backend can communicate directly.

How can I register a simple Java dynamic web application to make direct communication between them without using the third-party services like RabbitMQ?

1

There are 1 best solutions below

0
On

I think you are misunderstanding the use cases. The Netflix Eureka registry is for service registry that helps facilitate service to service communication.

Suppose a service - abc.foo.com and it needs to call another service pqr.foo.com. You don't want the path for the pqr service hardcoded in the abc service. Hardcoding like is an anti-pattern for cloud native applications. The approach is to have service abc and pqr register themselves with a service registry (eureka, consul, etc.). Then at runtime, the service, abc here, can interrogate registry and get an active instance of the pqr service and invoke it.

For your Java web applications, that need to call each other, I am assuming, all your interactions (service calls) are done on server-side. In which case, using Eureka registry, one microservice an easily find and get instance of another service and invoke it. You don't need RabbitMQ for that.

I would recommend looking at the jHipster project. It is an open source project. They have a Eureka based registry service, a gateway service, microservices and client-side UI (Node.js).

It will be a good starting point and there is a lot of open source help available.

I hope this helps!