Skip to content

Consul Service Discovery#

Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure. It’s often used as service discovery backend to register and locate the services composing your system. Consul makes it simple for services to register themselves and to discover other services via a DNS or HTTP interface. External services can be registered as well.

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

Dependency#

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

<dependency>
    <groupId>io.smallrye.stork</groupId>
    <artifactId>stork-service-discovery-consul</artifactId>
    <version>1.1.2</version>
</dependency>

Service discovery configuration#

For each service that should get the service instances from Consul, configure the service discovery type:

stork.my-service.service-discovery.type=consul
quarkus.stork.my-service.service-discovery.type=consul

Consul service discovery is configured with the following parameters:

Service registration#

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

Service registration configuration#

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

stork.my-service.service-registrar.type=consul
quarkus.stork.my-service.service-registrar.type=consul

Consul service registrar is configured with the following parameters: