use of com.orbitz.consul.model.agent.Registration in project camel by apache.
the class ConsulRibbonServiceCallRouteTest method doPreSetup.
// *************************************************************************
// Setup / tear down
// *************************************************************************
@Override
protected void doPreSetup() throws Exception {
client = getConsul().agentClient();
registrations = new ArrayList<>(SERVICE_COUNT);
expectedBodies = new ArrayList<>(SERVICE_COUNT);
for (int i = 0; i < SERVICE_COUNT; i++) {
Registration r = ImmutableRegistration.builder().id("service-" + i).name(SERVICE_NAME).address("127.0.0.1").port(SERVICE_PORT_BASE + i).build();
client.register(r);
registrations.add(r);
expectedBodies.add("ping on " + r.getPort().get());
}
}
use of com.orbitz.consul.model.agent.Registration in project microservices by pwillhan.
the class ConsulRegistrator method register.
public void register() {
try {
URL healthUrl = new URL("http", host, port, "/health");
Registration registration = new Registration();
registration.setAddress(host);
registration.setPort(port);
registration.setId(id);
registration.setName(name);
Registration.Check check = new Registration.Check();
check.setHttp(healthUrl.toExternalForm());
check.setInterval("5s");
registration.setCheck(check);
agentClient.register(registration);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
use of com.orbitz.consul.model.agent.Registration in project microservices by pwillhan.
the class ConsulRegistrator method register.
public void register() {
try {
URL healthUrl = new URL("http", host, port, "/health");
Registration registration = new Registration();
registration.setAddress(host);
registration.setPort(port);
registration.setId(id);
registration.setName(name);
Registration.Check check = new Registration.Check();
check.setHttp(healthUrl.toExternalForm());
check.setInterval("5s");
registration.setCheck(check);
agentClient.register(registration);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
use of com.orbitz.consul.model.agent.Registration in project camel by apache.
the class ConsulDefaultServiceCallRouteTest method doPreSetup.
// *************************************************************************
// Setup / tear down
// *************************************************************************
@Override
protected void doPreSetup() throws Exception {
client = getConsul().agentClient();
registrations = new ArrayList<>(SERVICE_COUNT);
expectedBodies = new ArrayList<>(SERVICE_COUNT);
for (int i = 0; i < SERVICE_COUNT; i++) {
Registration r = ImmutableRegistration.builder().id("service-" + i).name(SERVICE_NAME).address("127.0.0.1").port(SERVICE_PORT_BASE + i).build();
client.register(r);
registrations.add(r);
expectedBodies.add("ping on " + r.getPort().get());
}
}
use of com.orbitz.consul.model.agent.Registration in project camel by apache.
the class ConsulServiceDiscoveryTest method setUp.
@Before
public void setUp() throws Exception {
client = Consul.builder().build().agentClient();
registrations = new ArrayList<>(3);
for (int i = 0; i < 3; i++) {
Registration r = ImmutableRegistration.builder().id("service-" + i).name("my-service").address("127.0.0.1").addTags("a-tag").addTags("key1=value1").addTags("key2=value2").port(9000 + i).build();
client.register(r);
registrations.add(r);
}
}
Aggregations