Skip to content

Consul Service Registration#

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 registration.

Dependency#

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

<dependency>
    <groupId>io.smallrye.stork</groupId>
    <artifactId>stork-service-registration-consul</artifactId>
    <version>2.7.1</version>
</dependency>

Service registration configuration#

For each service that should register the service instances in Consul, configure the service registrar 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:

Attribute Mandatory Default Value Description
consul-host No localhost The Consul host.
consul-port No 8500 The Consul port.