Package halfpipe.consul.model

Examples of halfpipe.consul.model.Service


    @Autowired
    AgentClient client;

    @Test
    public void testRegisterService() {
        Service service = new Service();
        service.setId("test1id");
        service.setName("test1Name");
        service.setPort(9999);
        service.setTags(Lists.newArrayList("test1tag1", "test1tag2"));
        Check check = new Check();
        check.setScript("/usr/local/bin/gtrue");
        check.setInterval(60);
        service.setCheck(check);
        client.register(service);
    }
View Full Code Here


        ApplicationProperties appProps = context.getBean(ApplicationProperties.class);
        ServerProperties serverProperties = context.getBean(ServerProperties.class);
        AgentClient agentClient = context.getBean(AgentClient.class);

        Service service = new Service();
        service.setName(appProps.getId());
        Integer port = serverProperties.getPort();
        if (port == null) {
            port = 8080;
        }
        service.setPort(port);
        service.setTags(consulProperties.getTags());

        //TODO: add support for Check

        register(agentClient, service);

        String managementPort = context.getEnvironment().getProperty("management.port", (String) null);
        if (managementPort != null) {
            Service management = new Service();
            management.setName(appProps.getId() + "/management"); //TODO: configurable management suffix
            management.setPort(Integer.parseInt(managementPort));
            List<String> tags = new ArrayList<>(consulProperties.getTags());
            tags.add("management"); //TODO: configurable management tag
            management.setTags(tags);

            register(agentClient, management);
        }

        if (!appProps.getRoutes().isEmpty()) {
View Full Code Here

TOP

Related Classes of halfpipe.consul.model.Service

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.