@@ -32,7 +32,7 @@ class DruidEnvironment(
3232
3333 override def equals (other : Any ) = other match {
3434 case that : DruidEnvironment =>
35- (indexService, firehoseServicePattern) == (that.indexService, that.firehoseServicePattern)
35+ (indexService, firehoseServicePattern) == (that.indexService, that.firehoseServicePattern)
3636 case _ => false
3737 }
3838
@@ -41,21 +41,41 @@ class DruidEnvironment(
4141
4242object DruidEnvironment
4343{
44+ def apply (indexServiceMaybeWithSlashes : String ): DruidEnvironment = {
45+ new DruidEnvironment (indexServiceMaybeWithSlashes, defaultFirehoseServicePattern(indexServiceMaybeWithSlashes))
46+ }
47+
4448 def apply (indexServiceMaybeWithSlashes : String , firehoseServicePattern : String ): DruidEnvironment = {
4549 new DruidEnvironment (indexServiceMaybeWithSlashes, firehoseServicePattern)
4650 }
4751
4852 /**
49- * Factory method for creating DruidEnvironment objects. DruidEnvironments represent a Druid indexing service
50- * cluster, locatable through service discovery.
51- *
52- * @param indexServiceMaybeWithSlashes Your overlord's "druid.service" configuration. Slashes will be replaced with
53- * colons before searching for this in service discovery, because Druid does the
54- * same thing before announcing.
55- * @param firehoseServicePattern Make up a service pattern, include %s somewhere in it. This will be used for
56- * internal service-discovery purposes, to help Tranquility find Druid indexing tasks.
57- */
53+ * Factory method for creating DruidEnvironment objects. DruidEnvironments represent a Druid indexing service
54+ * cluster, locatable through service discovery.
55+ *
56+ * @param indexServiceMaybeWithSlashes Your overlord's "druid.service" configuration. Slashes will be replaced with
57+ * colons before searching for this in service discovery, because Druid does the
58+ * same thing before announcing.
59+ * @param firehoseServicePattern Make up a service pattern, include %s somewhere in it. This will be used for
60+ * internal service-discovery purposes, to help Tranquility find Druid indexing tasks.
61+ */
5862 def create (indexServiceMaybeWithSlashes : String , firehoseServicePattern : String ): DruidEnvironment = {
59- new DruidEnvironment (indexServiceMaybeWithSlashes, firehoseServicePattern)
63+ apply(indexServiceMaybeWithSlashes, firehoseServicePattern)
64+ }
65+
66+ /**
67+ * Factory method for creating DruidEnvironment objects. DruidEnvironments represent a Druid indexing service
68+ * cluster, locatable through service discovery.
69+ *
70+ * @param indexServiceMaybeWithSlashes Your overlord's "druid.service" configuration. Slashes will be replaced with
71+ * colons before searching for this in service discovery, because Druid does the
72+ * same thing before announcing.
73+ */
74+ def create (indexServiceMaybeWithSlashes : String ): DruidEnvironment = {
75+ apply(indexServiceMaybeWithSlashes)
76+ }
77+
78+ private def defaultFirehoseServicePattern (indexServiceMaybeWithSlashes : String ) = {
79+ s " firehose: ${indexServiceMaybeWithSlashes.replace('/' , ':' )}:%s "
6080 }
6181}
0 commit comments