All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ecwid.consul.LocalTest Maven / Gradle / Ivy

The newest version!
package com.ecwid.consul;

import com.ecwid.consul.v1.ConsulClient;
import com.ecwid.consul.v1.QueryParams;
import com.ecwid.consul.v1.Response;
import com.ecwid.consul.v1.agent.model.*;
import com.ecwid.consul.v1.catalog.CatalogNodesRequest;
import com.ecwid.consul.v1.catalog.model.CatalogRegistration;
import com.ecwid.consul.v1.session.model.NewSession;

import java.util.*;

public class LocalTest {

	public static void main(String[] args) {

		ConsulClient client = new ConsulClient("localhost", 8500);

		NewService newService = new NewService();
		newService.setId("vgv-test-" + System.currentTimeMillis());
		newService.setName("vgv-test");
		newService.setAddress("test.example.com");
		newService.setPort(null);

		NewService.Check check = new NewService.Check();
		check.setTtl("100s");
		check.setDeregisterCriticalServiceAfter("1000s");
		check.setStatus("passing");
		newService.setCheck(check);

		client.agentServiceRegister(newService, "d5923adf-6831-61af-ffe6-9b1cac3fe3c4");

		client.deleteKVValue("asd", "d5923adf-6831-61af-ffe6-9b1cac3fe3c4");

		client.getDatacenters();
	}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy