Skip to content

Eureka Service Discovery#

Eureka is a RESTful service that is primarily used in the AWS cloud for the purpose of discovery, load balancing, and failover of middle-tier servers.

This page explains how Stork can use Eureka to handle the service discovery and service registration.

Dependency#

First, you need to add the Stork Eureka Service Discovery provider:

<dependency>
    <groupId>io.smallrye.stork</groupId>
    <artifactId>stork-service-discovery-eureka</artifactId>
    <version>1.3.2</version>
</dependency>

Service discovery configuration#

For each application instance expected to be registered in Eureka, configure the lookup:

stork.my-service.service-discovery.type=eureka
stork.my-service.service-discovery.eureka-host=localhost
stork.my-service.service-discovery.eureka-port=8761
quarkus.stork.my-service.service-discovery.type=eureka
quarkus.stork.my-service.service-discovery.eureka-host=localhost
quarkus.stork.my-service.service-discovery.eureka-port=8761

Stork looks for the service with the given name (my-service in the previous example).

Supported attributes are the following:

Attribute Mandatory Default Value Description
eureka-host Yes The Eureka server host.
eureka-port No 8761 The Eureka server port.
eureka-context-path No / The Eureka server root context path.
application No The Eureka application Id; if not defined Stork service name will be used
eureka-trust-all No false Enable/Disable the TLS certificate verification
eureka-tls No false Use TLS to connect to the Eureka server
instance No The Eureka application instance Id
refresh-period No 5M Service discovery cache refresh period.
secure No false Whether is should select the secured endpoint of the retrieved services.

The application attribute is optional. It uses the Stork service name (my-service in the previous configuration) if not set.

The instance attribute allows selecting a specific instance. Using this attribute prevents load-balancing as you will always select a single instance.

The secure attribute indicates if you want the secure virtual address of the application instance. If set to true, unsecured instances are filtered out from the available instances.

Service registration#

Stork also provides the ability to register services using Eureka as backend.

Service registration configuration#

For each service that should register the service instances in Eureka, configure the service discovery type:

stork.my-service.service-registrar.type=eureka
stork.my-service.service-registrar.eureka-host=localhost
stork.my-service.service-registrar.eureka-port=8761
quarkus.stork.my-service.service-registrar.type=eureka
quarkus.stork.my-service.service-registrar.eureka-host=localhost
quarkus.stork.my-service.service-registrar.eureka-port=8761

Consul service registrar is configured with the following parameters:

Attribute Mandatory Default Value Description
eureka-host No localhost The Eureka host.
eureka-port No 8761 The Eureka port.
eureka-context-path No / The Eureka server root context path.
eureka-trust-all No false Enable/Disable the TLS certificate verification
eureka-tls No false Use TLS to connect to the Eureka server