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.tracking 21 22 import akka.actor.typed.Behavior 23 import org.make.api.technical.KafkaProducerBehavior 24 import org.make.core.{DateHelper, MakeSerializable} 25 26 import java.util.UUID 27 28 class DemographicsProducerBehavior extends KafkaProducerBehavior[DemographicEvent, DemographicEventWrapper] { 29 override protected val topicKey: String = DemographicsProducerBehavior.topicKey 30 override protected def wrapEvent(event: DemographicEvent): DemographicEventWrapper = { 31 DemographicEventWrapper( 32 version = MakeSerializable.V1, 33 id = UUID.randomUUID().toString, 34 date = DateHelper.now(), 35 eventType = event.demographic, 36 event = event 37 ) 38 } 39 } 40 41 object DemographicsProducerBehavior { 42 def apply(): Behavior[DemographicEvent] = new DemographicsProducerBehavior().createBehavior(name) 43 val name: String = "demographics-producer" 44 val topicKey: String = "demographics" 45 }
| Line | Stmt Id | Pos | Tree | Symbol | Tests | Code |
|---|---|---|---|---|---|---|
| 29 | 7017 | 1101 - 1138 | Select | org.make.api.technical.tracking.DemographicsProducerBehavior.topicKey | DemographicsProducerBehavior.topicKey | |
| 31 | 7713 | 1232 - 1426 | Apply | org.make.api.technical.tracking.DemographicEventWrapper.apply | DemographicEventWrapper.apply(org.make.core.MakeSerializable.V1, java.util.UUID.randomUUID().toString(), org.make.core.DateHelper.now(), event.demographic, event) | |
| 32 | 6103 | 1273 - 1292 | Select | org.make.core.MakeSerializable.V1 | org.make.core.MakeSerializable.V1 | |
| 33 | 7562 | 1305 - 1331 | Apply | java.util.UUID.toString | java.util.UUID.randomUUID().toString() | |
| 34 | 6665 | 1346 - 1362 | Apply | org.make.core.DefaultDateHelper.now | org.make.core.DateHelper.now() | |
| 35 | 6255 | 1382 - 1399 | Select | org.make.api.technical.tracking.DemographicEvent.demographic | event.demographic | |
| 42 | 6813 | 1566 - 1570 | Select | org.make.api.technical.tracking.DemographicsProducerBehavior.name | DemographicsProducerBehavior.this.name | |
| 42 | 6032 | 1516 - 1571 | Apply | org.make.api.technical.KafkaProducerBehavior.createBehavior | new DemographicsProducerBehavior().createBehavior(DemographicsProducerBehavior.this.name) | |
| 43 | 7787 | 1593 - 1616 | Literal | <nosymbol> | "demographics-producer" | |
| 44 | 6939 | 1642 - 1656 | Literal | <nosymbol> | "demographics" |