add broker default and define constants

This commit is contained in:
Xavier Léauté 2014-11-12 14:53:53 -08:00
parent 42a61290a8
commit 3a9def7fb1
3 changed files with 11 additions and 4 deletions

View File

@ -34,9 +34,12 @@ import java.util.List;
*/ */
public class TieredBrokerConfig public class TieredBrokerConfig
{ {
public static final String DEFAULT_COORDINATOR_SERVICE_NAME = "druid/coordinator";
public static final String DEFAULT_BROKER_SERVICE_NAME = "druid/broker";
@JsonProperty @JsonProperty
@NotNull @NotNull
private String defaultBrokerServiceName = ""; private String defaultBrokerServiceName = DEFAULT_BROKER_SERVICE_NAME;
@JsonProperty @JsonProperty
private LinkedHashMap<String, String> tierToBrokerMap; private LinkedHashMap<String, String> tierToBrokerMap;
@ -51,7 +54,7 @@ public class TieredBrokerConfig
@JsonProperty @JsonProperty
@NotNull @NotNull
private String coordinatorServiceName = "druid/coordinator"; private String coordinatorServiceName = DEFAULT_COORDINATOR_SERVICE_NAME;
@JsonProperty @JsonProperty
@NotNull @NotNull

View File

@ -50,6 +50,7 @@ import io.druid.server.QueryResource;
import io.druid.server.coordination.broker.DruidBroker; import io.druid.server.coordination.broker.DruidBroker;
import io.druid.server.initialization.JettyServerInitializer; import io.druid.server.initialization.JettyServerInitializer;
import io.druid.server.metrics.MetricsModule; import io.druid.server.metrics.MetricsModule;
import io.druid.server.router.TieredBrokerConfig;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import java.util.List; import java.util.List;
@ -78,7 +79,9 @@ public class CliBroker extends ServerRunnable
@Override @Override
public void configure(Binder binder) public void configure(Binder binder)
{ {
binder.bindConstant().annotatedWith(Names.named("serviceName")).to("druid/broker"); binder.bindConstant().annotatedWith(Names.named("serviceName")).to(
TieredBrokerConfig.DEFAULT_BROKER_SERVICE_NAME
);
binder.bindConstant().annotatedWith(Names.named("servicePort")).to(8082); binder.bindConstant().annotatedWith(Names.named("servicePort")).to(8082);
binder.bind(QueryToolChestWarehouse.class).to(MapQueryToolChestWarehouse.class); binder.bind(QueryToolChestWarehouse.class).to(MapQueryToolChestWarehouse.class);

View File

@ -58,6 +58,7 @@ import io.druid.server.http.RulesResource;
import io.druid.server.http.ServersResource; import io.druid.server.http.ServersResource;
import io.druid.server.http.TiersResource; import io.druid.server.http.TiersResource;
import io.druid.server.initialization.JettyServerInitializer; import io.druid.server.initialization.JettyServerInitializer;
import io.druid.server.router.TieredBrokerConfig;
import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.CuratorFramework;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
@ -88,7 +89,7 @@ public class CliCoordinator extends ServerRunnable
@Override @Override
public void configure(Binder binder) public void configure(Binder binder)
{ {
binder.bindConstant().annotatedWith(Names.named("serviceName")).to("druid/coordinator"); binder.bindConstant().annotatedWith(Names.named("serviceName")).to(TieredBrokerConfig.DEFAULT_COORDINATOR_SERVICE_NAME);
binder.bindConstant().annotatedWith(Names.named("servicePort")).to(8081); binder.bindConstant().annotatedWith(Names.named("servicePort")).to(8081);
ConfigProvider.bind(binder, DruidCoordinatorConfig.class); ConfigProvider.bind(binder, DruidCoordinatorConfig.class);