chetanmeh commented on a change in pull request #4628: Embedded Kafka support 
in OpenWhisk Standalone mode
URL: https://github.com/apache/openwhisk/pull/4628#discussion_r326184627
 
 

 ##########
 File path: 
core/standalone/src/main/scala/org/apache/openwhisk/standalone/KafkaLauncher.scala
 ##########
 @@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.openwhisk.standalone
+
+import java.io.File
+
+import akka.actor.ActorSystem
+import akka.stream.ActorMaterializer
+import kafka.server.KafkaConfig
+import net.manub.embeddedkafka.{EmbeddedKafka, EmbeddedKafkaConfig}
+import org.apache.commons.io.FileUtils
+import org.apache.openwhisk.common.{Logging, TransactionId}
+import org.apache.openwhisk.core.WhiskConfig
+import org.apache.openwhisk.core.WhiskConfig.kafkaHosts
+import org.apache.openwhisk.core.entity.ControllerInstanceId
+import org.apache.openwhisk.core.loadBalancer.{LeanBalancer, LoadBalancer, 
LoadBalancerProvider}
+import 
org.apache.openwhisk.standalone.StandaloneDockerSupport.{checkOrAllocatePort, 
containerName, createRunCmd}
+
+import scala.concurrent.{ExecutionContext, Future}
+import scala.reflect.io.Directory
+import scala.util.Try
+
+class KafkaLauncher(docker: StandaloneDockerClient,
+                    kafkaPort: Int,
+                    kafkaDockerPort: Int,
+                    zkPort: Int,
+                    workDir: File,
+                    kafkaUi: Boolean)(implicit logging: Logging,
+                                      ec: ExecutionContext,
+                                      actorSystem: ActorSystem,
+                                      materializer: ActorMaterializer,
+                                      tid: TransactionId) {
+
+  def run(): Future[Seq[ServiceContainer]] = {
+    for {
+      kafkaSvcs <- runKafka()
+      uiSvcs <- if (kafkaUi) runKafkaUI() else 
Future.successful(Seq.empty[ServiceContainer])
+    } yield kafkaSvcs ++ uiSvcs
+  }
+
+  def runKafka(): Future[Seq[ServiceContainer]] = {
+
+    //Below setting based on 
https://rmoff.net/2018/08/02/kafka-listeners-explained/
+    // We configure two listeners where one is used for host based application 
and other is used for docker based application
+    // to connect to Kafka server running on host
 
 Review comment:
   👍 Done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to