Package halfpipe.core

Examples of halfpipe.core.ApplicationProperties


        return new ServerProperties();
    }

    @Bean
    public ApplicationProperties halfpipeProperties(ApplicationContext context) {
        ApplicationProperties appProps = new ApplicationProperties();
        appProps.setId("testId");
        return appProps;
    }
View Full Code Here


        ApplicationContext context = event.getApplicationContext();
        ConsulProperties consulProperties = context.getBean(ConsulProperties.class);
        if (!consulProperties.isEnabled())
            return;

        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()) {
            try {
                KVClient kvClient = context.getBean(KVClient.class);

                String key = String.format("routing/%s", appProps.getId());
                //TODO: get routes from jax-rs and spring mvc
                kvClient.put(key, appProps.getRoutes());
            } catch (Exception e) {
                LOGGER.error("Error writing routes for app: " + appProps.getId(), e);
            }
        }
    }
View Full Code Here

TOP

Related Classes of halfpipe.core.ApplicationProperties

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.