Posted In: Micro, Service

Micro services – configuration management using CONSUL

This post shows one of the ways to create micro services architecture with enterprise level configuration services

KV Storage – Flexible key/value store for dynamic configuration, feature flagging, coordination, leader election and more. Long poll for near-instant notification of configuration changes.
Install CONSUL from


1. Start consul. (Click on consul.exe on windows)
2. Add consul-api java client library to maven
3. Add and fetch configuration parameters

package com.javausecase.consul;

import org.junit.Test;

import com.ecwid.consul.v1.ConsulClient;
import com.ecwid.consul.v1.Response;
import com.ecwid.consul.v1.kv.model.GetValue;

public class App {

	public void main() throws Exception {
		ConsulClient client = new ConsulClient("localhost");
		client.setKVValue("com.javausecase.db.jndi", "jdbc/javadb");
		client.setKVValue("com.javausecase.db.schema", "javausecase");

		Response<GetValue> keyValueResponse = client
		System.out.println(keyValueResponse.getValue().getKey() + ": "
				+ keyValueResponse.getValue().getDecodedValue());


by , on February 20th, 2018

  • Categories