1 /* 2 * Make.org Core API 3 * Copyright (C) 2018 Make.org 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU Affero General Public License as 7 * published by the Free Software Foundation, either version 3 of the 8 * License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Affero General Public License for more details. 14 * 15 * You should have received a copy of the GNU Affero General Public License 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 * 18 */ 19 20 package org.make.api.technical.crm 21 22 import akka.actor.typed.{ActorSystem, Behavior} 23 import org.make.api.technical.KafkaConsumerBehavior 24 25 import scala.concurrent.Future 26 27 class MailJetConsumerBehavior(crmService: CrmService) extends KafkaConsumerBehavior[SendMessages] { 28 29 override protected val topicKey: String = MailJetProducerBehavior.topicKey 30 31 override def handleMessage(message: SendMessages)(system: ActorSystem[_]): Future[_] = { 32 crmService.sendEmail(message) 33 } 34 35 override val groupId = "send-email-consumer" 36 } 37 38 object MailJetConsumerBehavior { 39 def apply(crmService: CrmService): Behavior[KafkaConsumerBehavior.Protocol] = 40 new MailJetConsumerBehavior(crmService).createBehavior(name) 41 val name: String = "send-email-consumer" 42 43 }
| Line | Stmt Id | Pos | Tree | Symbol | Tests | Code |
|---|---|---|---|---|---|---|
| 29 | 7424 | 1059 - 1091 | Select | org.make.api.technical.crm.MailJetProducerBehavior.topicKey | MailJetProducerBehavior.topicKey | |
| 32 | 6509 | 1188 - 1217 | Apply | org.make.api.technical.crm.CrmService.sendEmail | MailJetConsumerBehavior.this.crmService.sendEmail(message) | |
| 35 | 5718 | 1248 - 1269 | Literal | <nosymbol> | "send-email-consumer" | |
| 40 | 7101 | 1445 - 1449 | Select | org.make.api.technical.crm.MailJetConsumerBehavior.name | MailJetConsumerBehavior.this.name | |
| 40 | 6260 | 1390 - 1450 | Apply | org.make.api.technical.KafkaConsumerBehavior.createBehavior | new MailJetConsumerBehavior(crmService).createBehavior(MailJetConsumerBehavior.this.name) | |
| 41 | 5896 | 1472 - 1493 | Literal | <nosymbol> | "send-email-consumer" |