public void init(final String brokerBase) { init(brokerBase, new Environment()); }
public void init(final String brokerBase) { init(brokerBase, new Environment()); }
private void initSystemContext(final ActorClock clock, final String basePath) { LOG.debug("Initializing configuration with base path {}", basePath); brokerCfg.init(basePath); validateConfiguration(); final SocketBindingCfg clientApiCfg = brokerCfg.getNetwork().getClient(); final String brokerId = String.format("%s:%d", clientApiCfg.getHost(), clientApiCfg.getPort()); this.diagnosticContext = Collections.singletonMap(BROKER_ID_LOG_PROPERTY, brokerId); // TODO: submit diagnosticContext to actor scheduler once supported this.metricsManager = initMetricsManager(brokerId); this.scheduler = initScheduler(clock, brokerId); this.serviceContainer = new ServiceContainerImpl(this.scheduler); this.scheduler.start(); initBrokerInfoMetric(); setCloseTimeout(CLOSE_TIMEOUT); }
private void initSystemContext(final ActorClock clock, final String basePath) { LOG.debug("Initializing configuration with base path {}", basePath); brokerCfg.init(basePath); validateConfiguration(); final SocketBindingCfg clientApiCfg = brokerCfg.getNetwork().getClient(); final String brokerId = String.format("%s:%d", clientApiCfg.getHost(), clientApiCfg.getPort()); this.diagnosticContext = Collections.singletonMap(BROKER_ID_LOG_PROPERTY, brokerId); // TODO: submit diagnosticContext to actor scheduler once supported this.metricsManager = initMetricsManager(brokerId); this.scheduler = initScheduler(clock, brokerId); this.serviceContainer = new ServiceContainerImpl(this.scheduler); this.scheduler.start(); initBrokerInfoMetric(); setCloseTimeout(CLOSE_TIMEOUT); }
private BrokerCfg readConfig(final String name) { final String configPath = "/system/" + name + ".toml"; final InputStream resourceAsStream = ConfigurationTest.class.getResourceAsStream(configPath); assertThat(resourceAsStream) .withFailMessage("Unable to read configuration file %s", configPath) .isNotNull(); final BrokerCfg config = TomlConfigurationReader.read(resourceAsStream, BrokerCfg.class); config.init(BROKER_BASE, new Environment(environment)); return config; }
private BrokerCfg readConfig(final String name) { final String configPath = "/system/" + name + ".toml"; final InputStream resourceAsStream = ConfigurationTest.class.getResourceAsStream(configPath); assertThat(resourceAsStream) .withFailMessage("Unable to read configuration file %s", configPath) .isNotNull(); final BrokerCfg config = TomlConfigurationReader.read(resourceAsStream, BrokerCfg.class); config.init(BROKER_BASE, new Environment(environment)); return config; }
@Test public void shouldExpandExporterJarPathRelativeToBrokerBaseIffPresent() { // given final InputStream input = new ByteArrayInputStream( ("[[exporters]]\n" + "id=\"external\"\n" + "jarPath=\"exporters/exporter.jar\"\n" + "[[exporters]]\n" + "id=\"internal-1\"\n" + "jarPath=\"\"\n" + "[[exporters]]\n" + "id=\"internal-2\"") .getBytes()); final BrokerCfg config = TomlConfigurationReader.read(input, BrokerCfg.class); final String base = temporaryFolder.getRoot().getAbsolutePath(); final String jarFile = Paths.get(base, "exporters", "exporter.jar").toAbsolutePath().toString(); // when config.init(base); // then assertThat(config.getExporters()).hasSize(3); assertThat(config.getExporters().get(0)) .hasFieldOrPropertyWithValue("jarPath", jarFile) .is(new Condition<>(ExporterCfg::isExternal, "is external")); assertThat(config.getExporters().get(1).isExternal()).isFalse(); assertThat(config.getExporters().get(2).isExternal()).isFalse(); }
@Test public void shouldExpandExporterJarPathRelativeToBrokerBaseIffPresent() { // given final InputStream input = new ByteArrayInputStream( ("[[exporters]]\n" + "id=\"external\"\n" + "jarPath=\"exporters/exporter.jar\"\n" + "[[exporters]]\n" + "id=\"internal-1\"\n" + "jarPath=\"\"\n" + "[[exporters]]\n" + "id=\"internal-2\"") .getBytes()); final BrokerCfg config = TomlConfigurationReader.read(input, BrokerCfg.class); final String base = temporaryFolder.getRoot().getAbsolutePath(); final String jarFile = Paths.get(base, "exporters", "exporter.jar").toAbsolutePath().toString(); // when config.init(base); // then assertThat(config.getExporters()).hasSize(3); assertThat(config.getExporters().get(0)) .hasFieldOrPropertyWithValue("jarPath", jarFile) .is(new Condition<>(ExporterCfg::isExternal, "is external")); assertThat(config.getExporters().get(1).isExternal()).isFalse(); assertThat(config.getExporters().get(2).isExternal()).isFalse(); }