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.idea 21 22 import akka.actor.typed.Behavior 23 import org.make.api.technical.KafkaProducerBehavior 24 25 class IdeaProducerBehavior extends KafkaProducerBehavior[IdeaEvent, IdeaEventWrapper] { 26 override protected val topicKey: String = IdeaProducerBehavior.topicKey 27 override protected def wrapEvent(event: IdeaEvent): IdeaEventWrapper = { 28 IdeaEventWrapper( 29 version = event.version(), 30 id = event.ideaId.value, 31 date = event.eventDate, 32 eventType = event.getClass.getSimpleName, 33 event = event 34 ) 35 } 36 } 37 38 object IdeaProducerBehavior { 39 def apply(): Behavior[IdeaEvent] = new IdeaProducerBehavior().createBehavior(name) 40 val name: String = "idea-producer" 41 val topicKey: String = "ideas" 42 }
| Line | Stmt Id | Pos | Tree | Symbol | Tests | Code |
|---|---|---|---|---|---|---|
| 26 | 7359 | 990 - 1019 | Select | org.make.api.idea.IdeaProducerBehavior.topicKey | IdeaProducerBehavior.topicKey | |
| 28 | 5874 | 1099 - 1284 | Apply | org.make.api.idea.IdeaEventWrapper.apply | IdeaEventWrapper.apply(event.version(), event.ideaId.value, event.eventDate, event.getClass().getSimpleName(), event) | |
| 29 | 6519 | 1133 - 1148 | Apply | org.make.api.idea.IdeaEvent.version | event.version() | |
| 30 | 6105 | 1161 - 1179 | Select | org.make.core.idea.IdeaId.value | event.ideaId.value | |
| 31 | 7462 | 1194 - 1209 | Select | org.make.api.idea.IdeaEvent.eventDate | event.eventDate | |
| 32 | 6669 | 1229 - 1257 | Apply | java.lang.Class.getSimpleName | event.getClass().getSimpleName() | |
| 39 | 7619 | 1401 - 1405 | Select | org.make.api.idea.IdeaProducerBehavior.name | IdeaProducerBehavior.this.name | |
| 39 | 6814 | 1359 - 1406 | Apply | org.make.api.technical.KafkaProducerBehavior.createBehavior | new IdeaProducerBehavior().createBehavior(IdeaProducerBehavior.this.name) | |
| 40 | 5933 | 1428 - 1443 | Literal | <nosymbol> | "idea-producer" | |
| 41 | 7361 | 1469 - 1476 | Literal | <nosymbol> | "ideas" |