Search in sources :

Example 1 with ImmutableRegCheck

use of com.orbitz.consul.model.agent.ImmutableRegCheck in project jim-framework by jiangmin168168.

the class ConsulRegistryService method register.

@Override
public void register(RpcURL url) {
    Consul consul = this.buildConsul(url.getRegistryHost(), url.getRegistryPort());
    AgentClient agent = consul.agentClient();
    ImmutableRegCheck check = ImmutableRegCheck.builder().tcp(url.getHost() + ":" + url.getPort()).interval(CONSUL_HEALTH_INTERVAL).build();
    ImmutableRegistration.Builder builder = ImmutableRegistration.builder();
    builder.id(CONSUL_ID).name(CONSUL_NAME).addTags(CONSUL_TAGS).address(url.getHost()).port(url.getPort()).addChecks(check);
    agent.register(builder.build());
}
Also used : ImmutableRegCheck(com.orbitz.consul.model.agent.ImmutableRegCheck) ImmutableRegistration(com.orbitz.consul.model.agent.ImmutableRegistration) AgentClient(com.orbitz.consul.AgentClient) Consul(com.orbitz.consul.Consul)

Aggregations

AgentClient (com.orbitz.consul.AgentClient)1 Consul (com.orbitz.consul.Consul)1 ImmutableRegCheck (com.orbitz.consul.model.agent.ImmutableRegCheck)1 ImmutableRegistration (com.orbitz.consul.model.agent.ImmutableRegistration)1