openwhisk-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [openwhisk] chetanmeh commented on a change in pull request #4632: Activation Persister Service
Date Wed, 25 Sep 2019 06:47:33 GMT
chetanmeh commented on a change in pull request #4632: Activation Persister Service
URL: https://github.com/apache/openwhisk/pull/4632#discussion_r327955475
 
 

 ##########
 File path: common/scala/src/main/scala/org/apache/openwhisk/core/database/KafkaActivationStore.scala
 ##########
 @@ -0,0 +1,83 @@
+/*
+ * 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.core.database
+
+import akka.actor.ActorSystem
+import akka.stream.ActorMaterializer
+import org.apache.openwhisk.common.{Logging, TransactionId}
+import org.apache.openwhisk.core.{ConfigKeys, WhiskConfig}
+import org.apache.openwhisk.core.connector.{MessageProducer, MessagingProvider, ResultMessage}
+import org.apache.openwhisk.core.entity.{ActivationEntityLimit, ByteSize, DocInfo, WhiskActivation}
+import org.apache.openwhisk.spi.SpiLoader
+import org.apache.openwhisk.core.entity.size._
+import pureconfig.loadConfigOrThrow
+
+import scala.concurrent.Future
+import scala.util.Success
+
+case class KafkaActivationStoreConfig(activationsTopic: String, db: Boolean, maxRequestSize:
Option[ByteSize])
+
+class KafkaActivationStore(producer: MessageProducer,
+                           config: KafkaActivationStoreConfig,
+                           actorSystem: ActorSystem,
+                           actorMaterializer: ActorMaterializer,
+                           logging: Logging)
+    extends ArtifactActivationStore(actorSystem, actorMaterializer, logging) {
+
+  override def store(activation: WhiskActivation, context: UserContext)(
+    implicit transid: TransactionId,
+    notifier: Option[CacheChangeNotification]): Future[DocInfo] = {
+    if (config.db) {
+      sendToKafka(activation).flatMap(_ => super.store(activation, context))
 
 Review comment:
   With recent addition of `ActivationStoreWrapper` this is now handled and `KafkaActivationStore`
would now delegate to the configured primary store here if configured

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message