Netflix / eureka

AWS Service registry for resilient mid-tier load balancing and failover.
Apache License 2.0
12.39k stars 3.74k forks source link

Best possible Solution to register Non Spring boot Java Application with Eureka Server #1419

Open ammuvisalakshi opened 3 years ago

ammuvisalakshi commented 3 years ago

Hello Team,

I have a microservice built using Wildfly Bootable Jar and now would like to install with Eureka Server which is a Spring Boot microservice.

I have converted the JBOSS application to a wildfly microservice and have created a @WebListener that actually invokes register and deregister methods of Eureka Discovery up on startup and shut down of the service.

However I am looking for clean solution of how non spring boot can utilize the netflix eureka client something like side car and inject that in to any non native spring boot applciation to register with Eureka Server.

Could some one help on guiding me in right direction ?

Thanks & Regards, Visalakshi Ammu.

troshko111 commented 3 years ago

It's a simple RESTful API to register and heartbeat, see my answer here for an example.

ammuvisalakshi commented 3 years ago

Thank you @troshko111 for very quick response, let me try this out and get back to you.

ammuvisalakshi commented 3 years ago

Hello @troshko111 I think I am able to successfully use the CURL command referenced in the above link and use the EUREKA REST OPERATIONS successfully.

Could you please help me guide what is the ideal solution to have non spring boot to register with Eureka. Options I have are a) Use Eureka Client Wrapper and invoke it from Servlet of Non Spring boot, however not able to fully get to solution of passing values dynamically. b) Directly call the Eureka Server Via Rest calls ? Wondering if this is a good solution to have inside a WebListerner.

Thanks in advance.

troshko111 commented 3 years ago

It's hard to advise as it depends on a lot of factors (option a has the benefit of you not needing to understand the protocol or maintain it), I can say that the protocol is stable and breaking changes are not going to be introduced so going with b is not an issue, you only need to implement 2 RESTful API - register and heartbeat (post linked is the register call, heartbeat is trivial). So b may be more "lightweight" depending on your setup.

ammuvisalakshi commented 3 years ago

Thanks again @troshko111 I am not sure why I am finding it difficult to use the EurekaHttpClient directly, instead I need to implement the methods of TransportClinetFactory which is basically requires me to fill a lot of data.

Does netflix Eureka have any direct httpCient that accepts a Eureka Server URL and request body ?